{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 本周内容\n",
    "### 1. 分进合击\n",
    "### 2. 分分分\n",
    "### 3. 进进进\n",
    "### 4. 合合合\n",
    "### 5. 数据感\n",
    "**采用倒叙的方式进行学习**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. 合合合\n",
    "**用.agg的参数**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>企业名称</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>行业</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3D印刷</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>云计算</th>\n",
       "      <td>44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <td>40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>健康科技</th>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      企业名称\n",
       "行业        \n",
       "3D印刷     3\n",
       "云计算     44\n",
       "人工智能    40\n",
       "健康科技    27\n",
       "共享经济    22"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df = pd.read_csv(\"20春_pandas_week02_hurun_unicorn.tsv\",encoding = \"utf-8\",sep = \"\\t\")\n",
    "\n",
    "agg = {\"企业名称\":\"count\",\"估值（亿人民币）\":[\"sum\",\"mean\"],\"成立年份\":[\"max\",\"min\"],    \n",
    "}\n",
    "# 单组单列\n",
    "# 第一种写法\n",
    "data = df.groupby(\"行业\").agg({\"企业名称\":\"count\"})\n",
    "display(data.head())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>sum</th>\n",
       "      <th>count</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <td>54700</td>\n",
       "      <td>206</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <td>730</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <td>3850</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度尼西亚</th>\n",
       "      <td>1570</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>哥伦比亚</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>巴西</th>\n",
       "      <td>510</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>德国</th>\n",
       "      <td>1010</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新加坡</th>\n",
       "      <td>1350</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日本</th>\n",
       "      <td>220</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>法国</th>\n",
       "      <td>360</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>澳大利亚</th>\n",
       "      <td>200</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>爱尔兰</th>\n",
       "      <td>150</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>爱沙尼亚</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞典</th>\n",
       "      <td>450</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞士</th>\n",
       "      <td>720</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <td>47730</td>\n",
       "      <td>203</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芬兰</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>英国</th>\n",
       "      <td>2420</td>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>菲律宾</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西班牙</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>阿根廷</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>韩国</th>\n",
       "      <td>1360</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>马耳他</th>\n",
       "      <td>150</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         sum  count\n",
       "国家                 \n",
       "中国     54700    206\n",
       "以色列      730      7\n",
       "卢森堡       70      1\n",
       "印度      3850     21\n",
       "印度尼西亚   1570      4\n",
       "哥伦比亚      70      1\n",
       "巴西       510      4\n",
       "德国      1010      7\n",
       "新加坡     1350      2\n",
       "日本       220      2\n",
       "法国       360      4\n",
       "澳大利亚     200      1\n",
       "爱尔兰      150      1\n",
       "爱沙尼亚      70      1\n",
       "瑞典       450      2\n",
       "瑞士       720      3\n",
       "美国     47730    203\n",
       "芬兰        70      1\n",
       "英国      2420     13\n",
       "菲律宾       70      1\n",
       "西班牙       70      1\n",
       "阿根廷       70      1\n",
       "韩国      1360      6\n",
       "马耳他      150      1"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.groupby(\"国家\").agg([\"sum\",\"count\"])[\"估值（亿人民币）\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>企业名称</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>count</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>行业</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3D印刷</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>云计算</th>\n",
       "      <td>44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <td>40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>健康科技</th>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      企业名称\n",
       "     count\n",
       "行业        \n",
       "3D印刷     3\n",
       "云计算     44\n",
       "人工智能    40\n",
       "健康科技    27\n",
       "共享经济    22"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 第二种写法\n",
    "data2 = df.groupby(\"行业\")[[\"企业名称\"]].agg([\"count\"])\n",
    "display(data2.head())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>企业名称</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>行业</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3D印刷</th>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>云计算</th>\n",
       "      <td>44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <td>40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>健康科技</th>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      企业名称\n",
       "行业        \n",
       "3D印刷     3\n",
       "云计算     44\n",
       "人工智能    40\n",
       "健康科技    27\n",
       "共享经济    22"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 第三种写法\n",
    "data3 = df.groupby(\"行业\")[[\"企业名称\"]].count()\n",
    "display(data3.head())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th colspan=\"2\" halign=\"left\">估值（亿人民币）</th>\n",
       "      <th colspan=\"2\" halign=\"left\">成立年份</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>min</th>\n",
       "      <th>max</th>\n",
       "      <th>min</th>\n",
       "      <th>max</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <td>70</td>\n",
       "      <td>10000</td>\n",
       "      <td>2000</td>\n",
       "      <td>2019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <td>70</td>\n",
       "      <td>150</td>\n",
       "      <td>2002</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <td>70</td>\n",
       "      <td>70</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <td>70</td>\n",
       "      <td>700</td>\n",
       "      <td>2000</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度尼西亚</th>\n",
       "      <td>70</td>\n",
       "      <td>700</td>\n",
       "      <td>2009</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      估值（亿人民币）         成立年份      \n",
       "           min    max   min   max\n",
       "国家                               \n",
       "中国          70  10000  2000  2019\n",
       "以色列         70    150  2002  2013\n",
       "卢森堡         70     70  2014  2014\n",
       "印度          70    700  2000  2017\n",
       "印度尼西亚       70    700  2009  2012"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 单组多列，多列同样的agg\n",
    "df.groupby(\"国家\")[[\"估值（亿人民币）\",\"成立年份\"]].agg([\"min\",\"max\"]).head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>企业名称</th>\n",
       "      <th colspan=\"2\" halign=\"left\">估值（亿人民币）</th>\n",
       "      <th colspan=\"2\" halign=\"left\">成立年份</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>count</th>\n",
       "      <th>sum</th>\n",
       "      <th>mean</th>\n",
       "      <th>min</th>\n",
       "      <th>max</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <td>206</td>\n",
       "      <td>54700</td>\n",
       "      <td>265.533981</td>\n",
       "      <td>2000</td>\n",
       "      <td>2019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <td>7</td>\n",
       "      <td>730</td>\n",
       "      <td>104.285714</td>\n",
       "      <td>2002</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <td>21</td>\n",
       "      <td>3850</td>\n",
       "      <td>183.333333</td>\n",
       "      <td>2000</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度尼西亚</th>\n",
       "      <td>4</td>\n",
       "      <td>1570</td>\n",
       "      <td>392.500000</td>\n",
       "      <td>2009</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       企业名称 估值（亿人民币）              成立年份      \n",
       "      count      sum        mean   min   max\n",
       "国家                                          \n",
       "中国      206    54700  265.533981  2000  2019\n",
       "以色列       7      730  104.285714  2002  2013\n",
       "卢森堡       1       70   70.000000  2014  2014\n",
       "印度       21     3850  183.333333  2000  2017\n",
       "印度尼西亚     4     1570  392.500000  2009  2012"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 单组多列，多列不同的agg\n",
    "df.groupby(\"国家\").agg({\"企业名称\":\"count\",\"估值（亿人民币）\":[\"sum\",\"mean\"],\"成立年份\":[\"min\",\"max\"]}).head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### agg总结\n",
    "**agg的几种方式**   \n",
    "```\n",
    "1. df.groupby(\"某个变量\").agg({\"某个变量\":[\"count\",\"sum\"]})\n",
    "2. df.groupby(\"某个变量\")[[\"某个变量\",\"某个变量\"]].agg([\"max\",\"min\"])\n",
    "3. df.groupby(\"某个变量\")[[\"某个变量\",\"某个变量\"]].count()\n",
    "\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. 进进进\n",
    "计算数据\n",
    "**count,sum,mean,max,min**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>估值（亿人民币）</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>城市</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>-</th>\n",
       "      <td>370</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Burlington Massachussets</th>\n",
       "      <td>150</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Emerville</th>\n",
       "      <td>500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Foster City</th>\n",
       "      <td>200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Guilford</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Harrisburg</th>\n",
       "      <td>500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Plantation</th>\n",
       "      <td>400</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Stafford</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>上海</th>\n",
       "      <td>8990</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>东京</th>\n",
       "      <td>220</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>亚特兰大</th>\n",
       "      <td>360</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>伦敦</th>\n",
       "      <td>1700</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>伯班克</th>\n",
       "      <td>150</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>克利尔沃特</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>加迪纳</th>\n",
       "      <td>300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>北京</th>\n",
       "      <td>22130</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>匹兹堡</th>\n",
       "      <td>500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>半月湾</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>华盛顿</th>\n",
       "      <td>220</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>南京</th>\n",
       "      <td>1550</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卡尔弗城</th>\n",
       "      <td>220</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卡平特里亚</th>\n",
       "      <td>200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>古尔冈</th>\n",
       "      <td>1160</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>台北</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>哥伦布</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣何塞</th>\n",
       "      <td>270</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣保罗</th>\n",
       "      <td>510</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣克拉拉</th>\n",
       "      <td>140</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣卡洛斯</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>罗利</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>耐斯兹敖那</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>耶路撒冷</th>\n",
       "      <td>140</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>艾哈迈达巴德</th>\n",
       "      <td>150</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芝加哥</th>\n",
       "      <td>570</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>苗必达</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>菲尼克斯</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>菲蒙市</th>\n",
       "      <td>150</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>萨默维尔市</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西雅图</th>\n",
       "      <td>140</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>诺伊达</th>\n",
       "      <td>900</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>贝尔维尤</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>贵阳</th>\n",
       "      <td>400</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>赫尔辛基</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>达拉斯</th>\n",
       "      <td>300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>迈阿密</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>都柏林</th>\n",
       "      <td>150</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>重庆</th>\n",
       "      <td>170</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金华</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>门洛帕克</th>\n",
       "      <td>1300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>阿拉米达</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>阿林顿</th>\n",
       "      <td>200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>雅加达</th>\n",
       "      <td>1570</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>雷德伍德城</th>\n",
       "      <td>870</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>雷霍沃特</th>\n",
       "      <td>150</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>青岛</th>\n",
       "      <td>100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>首尔</th>\n",
       "      <td>1010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>香港</th>\n",
       "      <td>460</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>马卡迪</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>马德里</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>120 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                          估值（亿人民币）\n",
       "城市                                \n",
       "-                              370\n",
       "Burlington Massachussets       150\n",
       "Emerville                      500\n",
       "Foster City                    200\n",
       "Guilford                        70\n",
       "Harrisburg                     500\n",
       "Plantation                     400\n",
       "Stafford                        70\n",
       "上海                            8990\n",
       "东京                             220\n",
       "亚特兰大                           360\n",
       "伦敦                            1700\n",
       "伯班克                            150\n",
       "克利尔沃特                           70\n",
       "加迪纳                            300\n",
       "北京                           22130\n",
       "匹兹堡                            500\n",
       "半月湾                             70\n",
       "华盛顿                            220\n",
       "南京                            1550\n",
       "卡尔弗城                           220\n",
       "卡平特里亚                          200\n",
       "卢森堡                             70\n",
       "古尔冈                           1160\n",
       "台北                              70\n",
       "哥伦布                             70\n",
       "圣何塞                            270\n",
       "圣保罗                            510\n",
       "圣克拉拉                           140\n",
       "圣卡洛斯                            70\n",
       "...                            ...\n",
       "罗利                              70\n",
       "耐斯兹敖那                           70\n",
       "耶路撒冷                           140\n",
       "艾哈迈达巴德                         150\n",
       "芝加哥                            570\n",
       "苗必达                             70\n",
       "菲尼克斯                            70\n",
       "菲蒙市                            150\n",
       "萨默维尔市                           70\n",
       "西雅图                            140\n",
       "诺伊达                            900\n",
       "贝尔维尤                            70\n",
       "贵阳                             400\n",
       "赫尔辛基                            70\n",
       "达拉斯                            300\n",
       "迈阿密                             70\n",
       "都柏林                            150\n",
       "重庆                             170\n",
       "金华                              70\n",
       "门洛帕克                          1300\n",
       "阿拉米达                            70\n",
       "阿林顿                            200\n",
       "雅加达                           1570\n",
       "雷德伍德城                          870\n",
       "雷霍沃特                           150\n",
       "青岛                             100\n",
       "首尔                            1010\n",
       "香港                             460\n",
       "马卡迪                             70\n",
       "马德里                             70\n",
       "\n",
       "[120 rows x 1 columns]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from IPython.display import display, HTML\n",
    "# 计算某一项的总和\n",
    "#print(df[\"估值（亿人民币）\"].agg(\"sum\"))\n",
    "display(df[[\"城市\",\"估值（亿人民币）\"]].groupby(by=\"城市\").sum())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>估值（亿人民币）</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>城市</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>-</th>\n",
       "      <td>370</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Burlington Massachussets</th>\n",
       "      <td>150</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Emerville</th>\n",
       "      <td>500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Foster City</th>\n",
       "      <td>200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Guilford</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Harrisburg</th>\n",
       "      <td>500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Plantation</th>\n",
       "      <td>400</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Stafford</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>上海</th>\n",
       "      <td>8990</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>东京</th>\n",
       "      <td>220</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>亚特兰大</th>\n",
       "      <td>360</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>伦敦</th>\n",
       "      <td>1700</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>伯班克</th>\n",
       "      <td>150</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>克利尔沃特</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>加迪纳</th>\n",
       "      <td>300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>北京</th>\n",
       "      <td>22130</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>匹兹堡</th>\n",
       "      <td>500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>半月湾</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>华盛顿</th>\n",
       "      <td>220</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>南京</th>\n",
       "      <td>1550</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卡尔弗城</th>\n",
       "      <td>220</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卡平特里亚</th>\n",
       "      <td>200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>古尔冈</th>\n",
       "      <td>1160</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>台北</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>哥伦布</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣何塞</th>\n",
       "      <td>270</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣保罗</th>\n",
       "      <td>510</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣克拉拉</th>\n",
       "      <td>140</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣卡洛斯</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>罗利</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>耐斯兹敖那</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>耶路撒冷</th>\n",
       "      <td>140</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>艾哈迈达巴德</th>\n",
       "      <td>150</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芝加哥</th>\n",
       "      <td>570</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>苗必达</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>菲尼克斯</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>菲蒙市</th>\n",
       "      <td>150</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>萨默维尔市</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西雅图</th>\n",
       "      <td>140</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>诺伊达</th>\n",
       "      <td>900</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>贝尔维尤</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>贵阳</th>\n",
       "      <td>400</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>赫尔辛基</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>达拉斯</th>\n",
       "      <td>300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>迈阿密</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>都柏林</th>\n",
       "      <td>150</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>重庆</th>\n",
       "      <td>170</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金华</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>门洛帕克</th>\n",
       "      <td>1300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>阿拉米达</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>阿林顿</th>\n",
       "      <td>200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>雅加达</th>\n",
       "      <td>1570</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>雷德伍德城</th>\n",
       "      <td>870</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>雷霍沃特</th>\n",
       "      <td>150</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>青岛</th>\n",
       "      <td>100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>首尔</th>\n",
       "      <td>1010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>香港</th>\n",
       "      <td>460</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>马卡迪</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>马德里</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>120 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                          估值（亿人民币）\n",
       "城市                                \n",
       "-                              370\n",
       "Burlington Massachussets       150\n",
       "Emerville                      500\n",
       "Foster City                    200\n",
       "Guilford                        70\n",
       "Harrisburg                     500\n",
       "Plantation                     400\n",
       "Stafford                        70\n",
       "上海                            8990\n",
       "东京                             220\n",
       "亚特兰大                           360\n",
       "伦敦                            1700\n",
       "伯班克                            150\n",
       "克利尔沃特                           70\n",
       "加迪纳                            300\n",
       "北京                           22130\n",
       "匹兹堡                            500\n",
       "半月湾                             70\n",
       "华盛顿                            220\n",
       "南京                            1550\n",
       "卡尔弗城                           220\n",
       "卡平特里亚                          200\n",
       "卢森堡                             70\n",
       "古尔冈                           1160\n",
       "台北                              70\n",
       "哥伦布                             70\n",
       "圣何塞                            270\n",
       "圣保罗                            510\n",
       "圣克拉拉                           140\n",
       "圣卡洛斯                            70\n",
       "...                            ...\n",
       "罗利                              70\n",
       "耐斯兹敖那                           70\n",
       "耶路撒冷                           140\n",
       "艾哈迈达巴德                         150\n",
       "芝加哥                            570\n",
       "苗必达                             70\n",
       "菲尼克斯                            70\n",
       "菲蒙市                            150\n",
       "萨默维尔市                           70\n",
       "西雅图                            140\n",
       "诺伊达                            900\n",
       "贝尔维尤                            70\n",
       "贵阳                             400\n",
       "赫尔辛基                            70\n",
       "达拉斯                            300\n",
       "迈阿密                             70\n",
       "都柏林                            150\n",
       "重庆                             170\n",
       "金华                              70\n",
       "门洛帕克                          1300\n",
       "阿拉米达                            70\n",
       "阿林顿                            200\n",
       "雅加达                           1570\n",
       "雷德伍德城                          870\n",
       "雷霍沃特                           150\n",
       "青岛                             100\n",
       "首尔                            1010\n",
       "香港                             460\n",
       "马卡迪                             70\n",
       "马德里                             70\n",
       "\n",
       "[120 rows x 1 columns]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(df[[\"城市\",\"估值（亿人民币）\"]].groupby(by=\"城市\").agg(\"sum\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "max    2019\n",
       "min    2000\n",
       "Name: 成立年份, dtype: int64"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"成立年份\"].agg([\"max\",\"min\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>估值（亿人民币）</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>494.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>238.805668</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         估值（亿人民币）\n",
       "count  494.000000\n",
       "mean   238.805668"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[[\"估值（亿人民币）\"]].agg([\"count\",\"mean\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>企业名称</th>\n",
       "      <th>成立年份</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <td>麦奇教育科技</td>\n",
       "      <td>2019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <td>ironSource</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <td>Global Fashion Group</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <td>Zomato</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度尼西亚</th>\n",
       "      <td>Traveloka</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>哥伦比亚</th>\n",
       "      <td>Rappi</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>巴西</th>\n",
       "      <td>iFood</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>德国</th>\n",
       "      <td>Omio</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新加坡</th>\n",
       "      <td>Lazada</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日本</th>\n",
       "      <td>Preferred Networks</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>法国</th>\n",
       "      <td>Meero</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>澳大利亚</th>\n",
       "      <td>Canva</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>爱尔兰</th>\n",
       "      <td>Kaseya</td>\n",
       "      <td>2000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>爱沙尼亚</th>\n",
       "      <td>Bolt</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞典</th>\n",
       "      <td>Northvolt</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞士</th>\n",
       "      <td>Roivant Sciences</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <td>爱彼迎</td>\n",
       "      <td>2019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芬兰</th>\n",
       "      <td>HMD</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>英国</th>\n",
       "      <td>TransferWise</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>菲律宾</th>\n",
       "      <td>Revolution Precrafted</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西班牙</th>\n",
       "      <td>Cabify</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>阿根廷</th>\n",
       "      <td>Auth0</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>韩国</th>\n",
       "      <td>Yanolja</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>马耳他</th>\n",
       "      <td>Binance</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                        企业名称  成立年份\n",
       "国家                                \n",
       "中国                    麦奇教育科技  2019\n",
       "以色列               ironSource  2013\n",
       "卢森堡     Global Fashion Group  2014\n",
       "印度                    Zomato  2017\n",
       "印度尼西亚              Traveloka  2012\n",
       "哥伦比亚                   Rappi  2016\n",
       "巴西                     iFood  2013\n",
       "德国                      Omio  2014\n",
       "新加坡                   Lazada  2012\n",
       "日本        Preferred Networks  2014\n",
       "法国                     Meero  2016\n",
       "澳大利亚                   Canva  2012\n",
       "爱尔兰                   Kaseya  2000\n",
       "爱沙尼亚                    Bolt  2013\n",
       "瑞典                 Northvolt  2016\n",
       "瑞士          Roivant Sciences  2015\n",
       "美国                       爱彼迎  2019\n",
       "芬兰                       HMD  2016\n",
       "英国              TransferWise  2016\n",
       "菲律宾    Revolution Precrafted  2015\n",
       "西班牙                   Cabify  2011\n",
       "阿根廷                    Auth0  2013\n",
       "韩国                   Yanolja  2011\n",
       "马耳他                  Binance  2017"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(df[[\"国家\",\"企业名称\",\"成立年份\"]].groupby(by=\"国家\").max())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>企业名称</th>\n",
       "      <th>成立年份</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <td>麦奇教育科技</td>\n",
       "      <td>2019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <td>ironSource</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <td>Global Fashion Group</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <td>Zomato</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度尼西亚</th>\n",
       "      <td>Traveloka</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>哥伦比亚</th>\n",
       "      <td>Rappi</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>巴西</th>\n",
       "      <td>iFood</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>德国</th>\n",
       "      <td>Omio</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新加坡</th>\n",
       "      <td>Lazada</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日本</th>\n",
       "      <td>Preferred Networks</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>法国</th>\n",
       "      <td>Meero</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>澳大利亚</th>\n",
       "      <td>Canva</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>爱尔兰</th>\n",
       "      <td>Kaseya</td>\n",
       "      <td>2000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>爱沙尼亚</th>\n",
       "      <td>Bolt</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞典</th>\n",
       "      <td>Northvolt</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞士</th>\n",
       "      <td>Roivant Sciences</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <td>爱彼迎</td>\n",
       "      <td>2019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芬兰</th>\n",
       "      <td>HMD</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>英国</th>\n",
       "      <td>TransferWise</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>菲律宾</th>\n",
       "      <td>Revolution Precrafted</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西班牙</th>\n",
       "      <td>Cabify</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>阿根廷</th>\n",
       "      <td>Auth0</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>韩国</th>\n",
       "      <td>Yanolja</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>马耳他</th>\n",
       "      <td>Binance</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                        企业名称  成立年份\n",
       "国家                                \n",
       "中国                    麦奇教育科技  2019\n",
       "以色列               ironSource  2013\n",
       "卢森堡     Global Fashion Group  2014\n",
       "印度                    Zomato  2017\n",
       "印度尼西亚              Traveloka  2012\n",
       "哥伦比亚                   Rappi  2016\n",
       "巴西                     iFood  2013\n",
       "德国                      Omio  2014\n",
       "新加坡                   Lazada  2012\n",
       "日本        Preferred Networks  2014\n",
       "法国                     Meero  2016\n",
       "澳大利亚                   Canva  2012\n",
       "爱尔兰                   Kaseya  2000\n",
       "爱沙尼亚                    Bolt  2013\n",
       "瑞典                 Northvolt  2016\n",
       "瑞士          Roivant Sciences  2015\n",
       "美国                       爱彼迎  2019\n",
       "芬兰                       HMD  2016\n",
       "英国              TransferWise  2016\n",
       "菲律宾    Revolution Precrafted  2015\n",
       "西班牙                   Cabify  2011\n",
       "阿根廷                    Auth0  2013\n",
       "韩国                   Yanolja  2011\n",
       "马耳他                  Binance  2017"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "display(df[[\"国家\",\"企业名称\",\"成立年份\"]].groupby(by=\"国家\").agg(\"max\"))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3. 分分分\n",
    "**用groupby函数，数据切片**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<pandas.core.groupby.generic.DataFrameGroupBy object at 0x000001F51280F748>"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 切某一个层级\n",
    "a = df.groupby(\"国家\")\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<pandas.core.groupby.generic.DataFrameGroupBy object at 0x000001F515477978>"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 切多个层级\n",
    "b = df.groupby([\"国家\",\"行业\"])\n",
    "b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>企业名称</th>\n",
       "      <th>Company Name</th>\n",
       "      <th>估值（亿人民币）</th>\n",
       "      <th>城市</th>\n",
       "      <th>行业</th>\n",
       "      <th>掌门人/创始人</th>\n",
       "      <th>成立年份</th>\n",
       "      <th>部分投资机构</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度尼西亚</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>哥伦比亚</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>巴西</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>德国</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新加坡</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日本</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>法国</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>澳大利亚</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>爱尔兰</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>爱沙尼亚</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞典</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞士</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芬兰</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>英国</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>菲律宾</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西班牙</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>阿根廷</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>韩国</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>马耳他</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          排名    企业名称 Company Name 估值（亿人民币）      城市      行业 掌门人/创始人   成立年份  \\\n",
       "国家                                                                          \n",
       "中国     int64  object       object    int64  object  object  object  int64   \n",
       "以色列    int64  object       object    int64  object  object  object  int64   \n",
       "卢森堡    int64  object       object    int64  object  object  object  int64   \n",
       "印度     int64  object       object    int64  object  object  object  int64   \n",
       "印度尼西亚  int64  object       object    int64  object  object  object  int64   \n",
       "哥伦比亚   int64  object       object    int64  object  object  object  int64   \n",
       "巴西     int64  object       object    int64  object  object  object  int64   \n",
       "德国     int64  object       object    int64  object  object  object  int64   \n",
       "新加坡    int64  object       object    int64  object  object  object  int64   \n",
       "日本     int64  object       object    int64  object  object  object  int64   \n",
       "法国     int64  object       object    int64  object  object  object  int64   \n",
       "澳大利亚   int64  object       object    int64  object  object  object  int64   \n",
       "爱尔兰    int64  object       object    int64  object  object  object  int64   \n",
       "爱沙尼亚   int64  object       object    int64  object  object  object  int64   \n",
       "瑞典     int64  object       object    int64  object  object  object  int64   \n",
       "瑞士     int64  object       object    int64  object  object  object  int64   \n",
       "美国     int64  object       object    int64  object  object  object  int64   \n",
       "芬兰     int64  object       object    int64  object  object  object  int64   \n",
       "英国     int64  object       object    int64  object  object  object  int64   \n",
       "菲律宾    int64  object       object    int64  object  object  object  int64   \n",
       "西班牙    int64  object       object    int64  object  object  object  int64   \n",
       "阿根廷    int64  object       object    int64  object  object  object  int64   \n",
       "韩国     int64  object       object    int64  object  object  object  int64   \n",
       "马耳他    int64  object       object    int64  object  object  object  int64   \n",
       "\n",
       "       部分投资机构  \n",
       "国家             \n",
       "中国     object  \n",
       "以色列    object  \n",
       "卢森堡    object  \n",
       "印度     object  \n",
       "印度尼西亚  object  \n",
       "哥伦比亚   object  \n",
       "巴西     object  \n",
       "德国     object  \n",
       "新加坡    object  \n",
       "日本     object  \n",
       "法国     object  \n",
       "澳大利亚   object  \n",
       "爱尔兰    object  \n",
       "爱沙尼亚   object  \n",
       "瑞典     object  \n",
       "瑞士     object  \n",
       "美国     object  \n",
       "芬兰     object  \n",
       "英国     object  \n",
       "菲律宾    object  \n",
       "西班牙    object  \n",
       "阿根廷    object  \n",
       "韩国     object  \n",
       "马耳他    object  "
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 观察数据类型，哪些可以切，哪些可以合\n",
    "a.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>企业名称</th>\n",
       "      <th>Company Name</th>\n",
       "      <th>估值（亿人民币）</th>\n",
       "      <th>城市</th>\n",
       "      <th>掌门人/创始人</th>\n",
       "      <th>成立年份</th>\n",
       "      <th>部分投资机构</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th>行业</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"21\" valign=\"top\">中国</th>\n",
       "      <th>云计算</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>健康科技</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>区块链</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>大数据</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>媒体和娱乐</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>房地产科技</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>教育科技</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新能源</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新能源汽车</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新零售</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>机器人</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>消费品</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>游戏</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>网络安全</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>软件与服务</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">以色列</th>\n",
       "      <th>云计算</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>软件与服务</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <th>电子商务</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">印度</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>即时通讯</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>大数据</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>教育科技</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"14\" valign=\"top\">美国</th>\n",
       "      <th>新能源</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新能源汽车</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新零售</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>机器人</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>消费品</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>游戏</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>网络安全</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>航天</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>虚拟与增强现实</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>软件与服务</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芬兰</th>\n",
       "      <th>消费品</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"7\" valign=\"top\">英国</th>\n",
       "      <th>人工智能</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新能源</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>游戏</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>菲律宾</th>\n",
       "      <th>房地产科技</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西班牙</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>阿根廷</th>\n",
       "      <th>云计算</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">韩国</th>\n",
       "      <th>游戏</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>马耳他</th>\n",
       "      <th>区块链</th>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "      <td>object</td>\n",
       "      <td>int64</td>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>103 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                排名    企业名称 Company Name 估值（亿人民币）      城市 掌门人/创始人   成立年份  \\\n",
       "国家  行业                                                                    \n",
       "中国  云计算      int64  object       object    int64  object  object  int64   \n",
       "    人工智能     int64  object       object    int64  object  object  int64   \n",
       "    健康科技     int64  object       object    int64  object  object  int64   \n",
       "    共享经济     int64  object       object    int64  object  object  int64   \n",
       "    区块链      int64  object       object    int64  object  object  int64   \n",
       "    大数据      int64  object       object    int64  object  object  int64   \n",
       "    媒体和娱乐    int64  object       object    int64  object  object  int64   \n",
       "    房地产科技    int64  object       object    int64  object  object  int64   \n",
       "    教育科技     int64  object       object    int64  object  object  int64   \n",
       "    新能源      int64  object       object    int64  object  object  int64   \n",
       "    新能源汽车    int64  object       object    int64  object  object  int64   \n",
       "    新零售      int64  object       object    int64  object  object  int64   \n",
       "    机器人      int64  object       object    int64  object  object  int64   \n",
       "    消费品      int64  object       object    int64  object  object  int64   \n",
       "    游戏       int64  object       object    int64  object  object  int64   \n",
       "    物流       int64  object       object    int64  object  object  int64   \n",
       "    生命科学     int64  object       object    int64  object  object  int64   \n",
       "    电子商务     int64  object       object    int64  object  object  int64   \n",
       "    网络安全     int64  object       object    int64  object  object  int64   \n",
       "    软件与服务    int64  object       object    int64  object  object  int64   \n",
       "    金融科技     int64  object       object    int64  object  object  int64   \n",
       "以色列 云计算      int64  object       object    int64  object  object  int64   \n",
       "    人工智能     int64  object       object    int64  object  object  int64   \n",
       "    生命科学     int64  object       object    int64  object  object  int64   \n",
       "    软件与服务    int64  object       object    int64  object  object  int64   \n",
       "卢森堡 电子商务     int64  object       object    int64  object  object  int64   \n",
       "印度  共享经济     int64  object       object    int64  object  object  int64   \n",
       "    即时通讯     int64  object       object    int64  object  object  int64   \n",
       "    大数据      int64  object       object    int64  object  object  int64   \n",
       "    教育科技     int64  object       object    int64  object  object  int64   \n",
       "...            ...     ...          ...      ...     ...     ...    ...   \n",
       "美国  新能源      int64  object       object    int64  object  object  int64   \n",
       "    新能源汽车    int64  object       object    int64  object  object  int64   \n",
       "    新零售      int64  object       object    int64  object  object  int64   \n",
       "    机器人      int64  object       object    int64  object  object  int64   \n",
       "    消费品      int64  object       object    int64  object  object  int64   \n",
       "    游戏       int64  object       object    int64  object  object  int64   \n",
       "    物流       int64  object       object    int64  object  object  int64   \n",
       "    生命科学     int64  object       object    int64  object  object  int64   \n",
       "    电子商务     int64  object       object    int64  object  object  int64   \n",
       "    网络安全     int64  object       object    int64  object  object  int64   \n",
       "    航天       int64  object       object    int64  object  object  int64   \n",
       "    虚拟与增强现实  int64  object       object    int64  object  object  int64   \n",
       "    软件与服务    int64  object       object    int64  object  object  int64   \n",
       "    金融科技     int64  object       object    int64  object  object  int64   \n",
       "芬兰  消费品      int64  object       object    int64  object  object  int64   \n",
       "英国  人工智能     int64  object       object    int64  object  object  int64   \n",
       "    新能源      int64  object       object    int64  object  object  int64   \n",
       "    游戏       int64  object       object    int64  object  object  int64   \n",
       "    物流       int64  object       object    int64  object  object  int64   \n",
       "    生命科学     int64  object       object    int64  object  object  int64   \n",
       "    电子商务     int64  object       object    int64  object  object  int64   \n",
       "    金融科技     int64  object       object    int64  object  object  int64   \n",
       "菲律宾 房地产科技    int64  object       object    int64  object  object  int64   \n",
       "西班牙 共享经济     int64  object       object    int64  object  object  int64   \n",
       "阿根廷 云计算      int64  object       object    int64  object  object  int64   \n",
       "韩国  游戏       int64  object       object    int64  object  object  int64   \n",
       "    物流       int64  object       object    int64  object  object  int64   \n",
       "    电子商务     int64  object       object    int64  object  object  int64   \n",
       "    金融科技     int64  object       object    int64  object  object  int64   \n",
       "马耳他 区块链      int64  object       object    int64  object  object  int64   \n",
       "\n",
       "             部分投资机构  \n",
       "国家  行业               \n",
       "中国  云计算      object  \n",
       "    人工智能     object  \n",
       "    健康科技     object  \n",
       "    共享经济     object  \n",
       "    区块链      object  \n",
       "    大数据      object  \n",
       "    媒体和娱乐    object  \n",
       "    房地产科技    object  \n",
       "    教育科技     object  \n",
       "    新能源      object  \n",
       "    新能源汽车    object  \n",
       "    新零售      object  \n",
       "    机器人      object  \n",
       "    消费品      object  \n",
       "    游戏       object  \n",
       "    物流       object  \n",
       "    生命科学     object  \n",
       "    电子商务     object  \n",
       "    网络安全     object  \n",
       "    软件与服务    object  \n",
       "    金融科技     object  \n",
       "以色列 云计算      object  \n",
       "    人工智能     object  \n",
       "    生命科学     object  \n",
       "    软件与服务    object  \n",
       "卢森堡 电子商务     object  \n",
       "印度  共享经济     object  \n",
       "    即时通讯     object  \n",
       "    大数据      object  \n",
       "    教育科技     object  \n",
       "...             ...  \n",
       "美国  新能源      object  \n",
       "    新能源汽车    object  \n",
       "    新零售      object  \n",
       "    机器人      object  \n",
       "    消费品      object  \n",
       "    游戏       object  \n",
       "    物流       object  \n",
       "    生命科学     object  \n",
       "    电子商务     object  \n",
       "    网络安全     object  \n",
       "    航天       object  \n",
       "    虚拟与增强现实  object  \n",
       "    软件与服务    object  \n",
       "    金融科技     object  \n",
       "芬兰  消费品      object  \n",
       "英国  人工智能     object  \n",
       "    新能源      object  \n",
       "    游戏       object  \n",
       "    物流       object  \n",
       "    生命科学     object  \n",
       "    电子商务     object  \n",
       "    金融科技     object  \n",
       "菲律宾 房地产科技    object  \n",
       "西班牙 共享经济     object  \n",
       "阿根廷 云计算      object  \n",
       "韩国  游戏       object  \n",
       "    物流       object  \n",
       "    电子商务     object  \n",
       "    金融科技     object  \n",
       "马耳他 区块链      object  \n",
       "\n",
       "[103 rows x 8 columns]"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>估值（亿人民币）</th>\n",
       "      <th>成立年份</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th>行业</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"21\" valign=\"top\">中国</th>\n",
       "      <th>云计算</th>\n",
       "      <td>230.800000</td>\n",
       "      <td>92.000000</td>\n",
       "      <td>2012.400000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <td>189.333333</td>\n",
       "      <td>139.333333</td>\n",
       "      <td>2013.466667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>健康科技</th>\n",
       "      <td>206.538462</td>\n",
       "      <td>158.461538</td>\n",
       "      <td>2011.384615</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <td>148.750000</td>\n",
       "      <td>592.500000</td>\n",
       "      <td>2014.375000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>区块链</th>\n",
       "      <td>116.500000</td>\n",
       "      <td>312.500000</td>\n",
       "      <td>2014.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>大数据</th>\n",
       "      <td>250.666667</td>\n",
       "      <td>80.000000</td>\n",
       "      <td>2011.111111</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>媒体和娱乐</th>\n",
       "      <td>151.647059</td>\n",
       "      <td>484.117647</td>\n",
       "      <td>2011.529412</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>房地产科技</th>\n",
       "      <td>183.142857</td>\n",
       "      <td>191.428571</td>\n",
       "      <td>2012.571429</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>教育科技</th>\n",
       "      <td>211.272727</td>\n",
       "      <td>108.181818</td>\n",
       "      <td>2010.181818</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新能源</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2007.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新能源汽车</th>\n",
       "      <td>168.500000</td>\n",
       "      <td>150.833333</td>\n",
       "      <td>2015.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新零售</th>\n",
       "      <td>232.500000</td>\n",
       "      <td>90.000000</td>\n",
       "      <td>2013.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>机器人</th>\n",
       "      <td>98.666667</td>\n",
       "      <td>466.666667</td>\n",
       "      <td>2010.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>消费品</th>\n",
       "      <td>170.750000</td>\n",
       "      <td>155.000000</td>\n",
       "      <td>2014.750000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>游戏</th>\n",
       "      <td>224.000000</td>\n",
       "      <td>100.000000</td>\n",
       "      <td>2015.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <td>182.125000</td>\n",
       "      <td>244.375000</td>\n",
       "      <td>2011.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <td>209.000000</td>\n",
       "      <td>110.000000</td>\n",
       "      <td>2010.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>209.424242</td>\n",
       "      <td>127.878788</td>\n",
       "      <td>2011.303030</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>网络安全</th>\n",
       "      <td>84.000000</td>\n",
       "      <td>200.000000</td>\n",
       "      <td>2015.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>软件与服务</th>\n",
       "      <td>224.533333</td>\n",
       "      <td>97.333333</td>\n",
       "      <td>2010.400000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <td>174.363636</td>\n",
       "      <td>816.363636</td>\n",
       "      <td>2012.136364</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">以色列</th>\n",
       "      <th>云计算</th>\n",
       "      <td>201.000000</td>\n",
       "      <td>110.000000</td>\n",
       "      <td>2011.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>软件与服务</th>\n",
       "      <td>138.000000</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2002.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <th>电子商务</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">印度</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>119.000000</td>\n",
       "      <td>273.333333</td>\n",
       "      <td>2013.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>即时通讯</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>大数据</th>\n",
       "      <td>138.000000</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2004.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>教育科技</th>\n",
       "      <td>43.000000</td>\n",
       "      <td>400.000000</td>\n",
       "      <td>2008.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"14\" valign=\"top\">美国</th>\n",
       "      <th>新能源</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2007.800000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新能源汽车</th>\n",
       "      <td>123.666667</td>\n",
       "      <td>240.000000</td>\n",
       "      <td>2012.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新零售</th>\n",
       "      <td>243.000000</td>\n",
       "      <td>83.333333</td>\n",
       "      <td>2010.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>机器人</th>\n",
       "      <td>84.000000</td>\n",
       "      <td>200.000000</td>\n",
       "      <td>2016.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>消费品</th>\n",
       "      <td>173.000000</td>\n",
       "      <td>580.000000</td>\n",
       "      <td>2012.714286</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>游戏</th>\n",
       "      <td>124.000000</td>\n",
       "      <td>194.000000</td>\n",
       "      <td>2008.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <td>148.777778</td>\n",
       "      <td>256.666667</td>\n",
       "      <td>2012.888889</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <td>131.600000</td>\n",
       "      <td>266.000000</td>\n",
       "      <td>2011.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>201.235294</td>\n",
       "      <td>155.294118</td>\n",
       "      <td>2011.411765</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>网络安全</th>\n",
       "      <td>225.666667</td>\n",
       "      <td>141.666667</td>\n",
       "      <td>2010.833333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>航天</th>\n",
       "      <td>118.666667</td>\n",
       "      <td>923.333333</td>\n",
       "      <td>2006.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>虚拟与增强现实</th>\n",
       "      <td>50.000000</td>\n",
       "      <td>350.000000</td>\n",
       "      <td>2010.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>软件与服务</th>\n",
       "      <td>232.500000</td>\n",
       "      <td>90.000000</td>\n",
       "      <td>2010.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <td>144.761905</td>\n",
       "      <td>239.047619</td>\n",
       "      <td>2010.952381</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芬兰</th>\n",
       "      <th>消费品</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2016.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"7\" valign=\"top\">英国</th>\n",
       "      <th>人工智能</th>\n",
       "      <td>138.000000</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2014.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新能源</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2009.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>游戏</th>\n",
       "      <td>138.000000</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2012.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <td>138.000000</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2012.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <td>138.000000</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2005.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>50.000000</td>\n",
       "      <td>350.000000</td>\n",
       "      <td>2004.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <td>97.333333</td>\n",
       "      <td>208.333333</td>\n",
       "      <td>2012.833333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>菲律宾</th>\n",
       "      <th>房地产科技</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2015.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西班牙</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>阿根廷</th>\n",
       "      <th>云计算</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">韩国</th>\n",
       "      <th>游戏</th>\n",
       "      <td>50.000000</td>\n",
       "      <td>350.000000</td>\n",
       "      <td>2007.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <td>84.000000</td>\n",
       "      <td>200.000000</td>\n",
       "      <td>2011.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>184.333333</td>\n",
       "      <td>246.666667</td>\n",
       "      <td>2008.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>马耳他</th>\n",
       "      <th>区块链</th>\n",
       "      <td>138.000000</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2017.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>103 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                     排名    估值（亿人民币）         成立年份\n",
       "国家  行业                                          \n",
       "中国  云计算      230.800000   92.000000  2012.400000\n",
       "    人工智能     189.333333  139.333333  2013.466667\n",
       "    健康科技     206.538462  158.461538  2011.384615\n",
       "    共享经济     148.750000  592.500000  2014.375000\n",
       "    区块链      116.500000  312.500000  2014.000000\n",
       "    大数据      250.666667   80.000000  2011.111111\n",
       "    媒体和娱乐    151.647059  484.117647  2011.529412\n",
       "    房地产科技    183.142857  191.428571  2012.571429\n",
       "    教育科技     211.272727  108.181818  2010.181818\n",
       "    新能源      264.000000   70.000000  2007.000000\n",
       "    新能源汽车    168.500000  150.833333  2015.666667\n",
       "    新零售      232.500000   90.000000  2013.500000\n",
       "    机器人       98.666667  466.666667  2010.333333\n",
       "    消费品      170.750000  155.000000  2014.750000\n",
       "    游戏       224.000000  100.000000  2015.000000\n",
       "    物流       182.125000  244.375000  2011.250000\n",
       "    生命科学     209.000000  110.000000  2010.500000\n",
       "    电子商务     209.424242  127.878788  2011.303030\n",
       "    网络安全      84.000000  200.000000  2015.000000\n",
       "    软件与服务    224.533333   97.333333  2010.400000\n",
       "    金融科技     174.363636  816.363636  2012.136364\n",
       "以色列 云计算      201.000000  110.000000  2011.500000\n",
       "    人工智能     264.000000   70.000000  2010.000000\n",
       "    生命科学     264.000000   70.000000  2010.000000\n",
       "    软件与服务    138.000000  150.000000  2002.000000\n",
       "卢森堡 电子商务     264.000000   70.000000  2014.000000\n",
       "印度  共享经济     119.000000  273.333333  2013.333333\n",
       "    即时通讯     264.000000   70.000000  2012.000000\n",
       "    大数据      138.000000  150.000000  2004.000000\n",
       "    教育科技      43.000000  400.000000  2008.000000\n",
       "...                 ...         ...          ...\n",
       "美国  新能源      264.000000   70.000000  2007.800000\n",
       "    新能源汽车    123.666667  240.000000  2012.666667\n",
       "    新零售      243.000000   83.333333  2010.500000\n",
       "    机器人       84.000000  200.000000  2016.000000\n",
       "    消费品      173.000000  580.000000  2012.714286\n",
       "    游戏       124.000000  194.000000  2008.000000\n",
       "    物流       148.777778  256.666667  2012.888889\n",
       "    生命科学     131.600000  266.000000  2011.500000\n",
       "    电子商务     201.235294  155.294118  2011.411765\n",
       "    网络安全     225.666667  141.666667  2010.833333\n",
       "    航天       118.666667  923.333333  2006.666667\n",
       "    虚拟与增强现实   50.000000  350.000000  2010.500000\n",
       "    软件与服务    232.500000   90.000000  2010.500000\n",
       "    金融科技     144.761905  239.047619  2010.952381\n",
       "芬兰  消费品      264.000000   70.000000  2016.000000\n",
       "英国  人工智能     138.000000  150.000000  2014.500000\n",
       "    新能源      264.000000   70.000000  2009.000000\n",
       "    游戏       138.000000  150.000000  2012.000000\n",
       "    物流       138.000000  150.000000  2012.000000\n",
       "    生命科学     138.000000  150.000000  2005.000000\n",
       "    电子商务      50.000000  350.000000  2004.000000\n",
       "    金融科技      97.333333  208.333333  2012.833333\n",
       "菲律宾 房地产科技    264.000000   70.000000  2015.000000\n",
       "西班牙 共享经济     264.000000   70.000000  2011.000000\n",
       "阿根廷 云计算      264.000000   70.000000  2013.000000\n",
       "韩国  游戏        50.000000  350.000000  2007.000000\n",
       "    物流        84.000000  200.000000  2011.000000\n",
       "    电子商务     184.333333  246.666667  2008.333333\n",
       "    金融科技     264.000000   70.000000  2011.000000\n",
       "马耳他 区块链      138.000000  150.000000  2017.000000\n",
       "\n",
       "[103 rows x 3 columns]"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b.mean()\n",
    "# 只保留了int列，没有object列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'中国': Int64Index([  0,   1,   2,   6,  10,  11,  12,  13,  14,  19,\n",
       "             ...\n",
       "             481, 482, 483, 484, 485, 486, 487, 488, 490, 491],\n",
       "            dtype='int64', length=206),\n",
       " '以色列': Int64Index([178, 184, 190, 310, 364, 384, 415], dtype='int64'),\n",
       " '卢森堡': Int64Index([342], dtype='int64'),\n",
       " '印度': Int64Index([ 23,  42,  45,  52,  81, 113, 123, 146, 163, 192, 206, 287, 323,\n",
       "             347, 361, 410, 422, 425, 432, 437, 465],\n",
       "            dtype='int64'),\n",
       " '印度尼西亚': Int64Index([22, 39, 74, 294], dtype='int64'),\n",
       " '哥伦比亚': Int64Index([427], dtype='int64'),\n",
       " '巴西': Int64Index([66, 344, 358, 389], dtype='int64'),\n",
       " '德国': Int64Index([56, 108, 160, 169, 269, 339, 411], dtype='int64'),\n",
       " '新加坡': Int64Index([15, 50], dtype='int64'),\n",
       " '日本': Int64Index([202, 388], dtype='int64'),\n",
       " '法国': Int64Index([149, 317, 320, 396], dtype='int64'),\n",
       " '澳大利亚': Int64Index([88], dtype='int64'),\n",
       " '爱尔兰': Int64Index([182], dtype='int64'),\n",
       " '爱沙尼亚': Int64Index([290], dtype='int64'),\n",
       " '瑞典': Int64Index([62, 196], dtype='int64'),\n",
       " '瑞士': Int64Index([36, 167, 400], dtype='int64'),\n",
       " '美国': Int64Index([  3,   4,   5,   7,   8,   9,  16,  17,  18,  21,\n",
       "             ...\n",
       "             463, 466, 469, 470, 471, 472, 474, 489, 492, 493],\n",
       "            dtype='int64', length=203),\n",
       " '芬兰': Int64Index([349], dtype='int64'),\n",
       " '英国': Int64Index([55, 73, 82, 107, 110, 145, 157, 164, 172, 177, 197, 207, 418], dtype='int64'),\n",
       " '菲律宾': Int64Index([431], dtype='int64'),\n",
       " '西班牙': Int64Index([297], dtype='int64'),\n",
       " '阿根廷': Int64Index([281], dtype='int64'),\n",
       " '韩国': Int64Index([26, 49, 129, 458, 459, 479], dtype='int64'),\n",
       " '马耳他': Int64Index([147], dtype='int64')}"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.groups\n",
    "# groups是groupby的是一个属性，是一个字典"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{('中国', '云计算'): Int64Index([183, 251, 325, 464, 467], dtype='int64'),\n",
       " ('中国',\n",
       "  '人工智能'): Int64Index([46, 63, 91, 102, 153, 218, 241, 255, 267, 285, 337, 401, 402, 403,\n",
       "             414],\n",
       "            dtype='int64'),\n",
       " ('中国',\n",
       "  '健康科技'): Int64Index([27, 48, 77, 234, 245, 279, 305, 326, 345, 356, 380, 398, 454], dtype='int64'),\n",
       " ('中国',\n",
       "  '共享经济'): Int64Index([2, 47, 99, 127, 224, 254, 378, 438], dtype='int64'),\n",
       " ('中国', '区块链'): Int64Index([19, 87, 150, 226], dtype='int64'),\n",
       " ('中国',\n",
       "  '大数据'): Int64Index([232, 244, 250, 321, 338, 352, 372, 385, 451], dtype='int64'),\n",
       " ('中国',\n",
       "  '媒体和娱乐'): Int64Index([1, 13, 85, 93, 95, 101, 132, 154, 214, 220, 235, 242, 260, 275,\n",
       "             387, 392, 482],\n",
       "            dtype='int64'),\n",
       " ('中国', '房地产科技'): Int64Index([24, 80, 225, 240, 259, 332, 468], dtype='int64'),\n",
       " ('中国',\n",
       "  '教育科技'): Int64Index([128, 134, 136, 229, 265, 313, 353, 354, 365, 377, 490], dtype='int64'),\n",
       " ('中国', '新能源'): Int64Index([328, 423], dtype='int64'),\n",
       " ('中国',\n",
       "  '新能源汽车'): Int64Index([78, 79, 120, 133, 152, 158, 223, 227, 249, 292, 351, 381], dtype='int64'),\n",
       " ('中国', '新零售'): Int64Index([189, 266, 299, 407], dtype='int64'),\n",
       " ('中国', '机器人'): Int64Index([14, 76, 243], dtype='int64'),\n",
       " ('中国', '消费品'): Int64Index([69, 205, 257, 442], dtype='int64'),\n",
       " ('中国', '游戏'): Int64Index([230], dtype='int64'),\n",
       " ('中国',\n",
       "  '物流'): Int64Index([11, 20, 43, 64, 105, 181, 246, 248, 278, 334, 371, 379, 390, 481,\n",
       "             484, 488],\n",
       "            dtype='int64'),\n",
       " ('中国', '生命科学'): Int64Index([100, 258, 408, 441], dtype='int64'),\n",
       " ('中国',\n",
       "  '电子商务'): Int64Index([ 25,  34, 103, 106, 122, 131, 187, 215, 231, 236, 237, 238, 239,\n",
       "             247, 253, 256, 262, 286, 291, 303, 304, 333, 363, 368, 369, 370,\n",
       "             421, 428, 477, 480, 483, 485, 491],\n",
       "            dtype='int64'),\n",
       " ('中国', '网络安全'): Int64Index([116], dtype='int64'),\n",
       " ('中国',\n",
       "  '软件与服务'): Int64Index([130, 139, 141, 228, 233, 252, 261, 314, 336, 350, 359, 393, 476,\n",
       "             478, 487],\n",
       "            dtype='int64'),\n",
       " ('中国',\n",
       "  '金融科技'): Int64Index([  0,   6,  10,  12,  35,  37,  89,  96, 199, 263, 268, 273, 274,\n",
       "             318, 327, 383, 386, 429, 439, 473, 475, 486],\n",
       "            dtype='int64'),\n",
       " ('以色列', '云计算'): Int64Index([178, 190, 310, 384], dtype='int64'),\n",
       " ('以色列', '人工智能'): Int64Index([415], dtype='int64'),\n",
       " ('以色列', '生命科学'): Int64Index([364], dtype='int64'),\n",
       " ('以色列', '软件与服务'): Int64Index([184], dtype='int64'),\n",
       " ('卢森堡', '电子商务'): Int64Index([342], dtype='int64'),\n",
       " ('印度', '共享经济'): Int64Index([45, 52, 410], dtype='int64'),\n",
       " ('印度', '即时通讯'): Int64Index([347], dtype='int64'),\n",
       " ('印度', '大数据'): Int64Index([192], dtype='int64'),\n",
       " ('印度', '教育科技'): Int64Index([42], dtype='int64'),\n",
       " ('印度', '新能源'): Int64Index([206], dtype='int64'),\n",
       " ('印度', '新零售'): Int64Index([287], dtype='int64'),\n",
       " ('印度', '游戏'): Int64Index([323], dtype='int64'),\n",
       " ('印度', '物流'): Int64Index([81, 123, 163, 432], dtype='int64'),\n",
       " ('印度', '电子商务'): Int64Index([113, 425, 437, 465], dtype='int64'),\n",
       " ('印度', '软件与服务'): Int64Index([361], dtype='int64'),\n",
       " ('印度', '金融科技'): Int64Index([23, 146, 422], dtype='int64'),\n",
       " ('印度尼西亚', '共享经济'): Int64Index([22], dtype='int64'),\n",
       " ('印度尼西亚', '电子商务'): Int64Index([39, 74, 294], dtype='int64'),\n",
       " ('哥伦比亚', '物流'): Int64Index([427], dtype='int64'),\n",
       " ('巴西', '健康科技'): Int64Index([344], dtype='int64'),\n",
       " ('巴西', '物流'): Int64Index([358, 389], dtype='int64'),\n",
       " ('巴西', '金融科技'): Int64Index([66], dtype='int64'),\n",
       " ('德国', '生命科学'): Int64Index([160], dtype='int64'),\n",
       " ('德国', '电子商务'): Int64Index([56, 169, 269, 339, 411], dtype='int64'),\n",
       " ('德国', '金融科技'): Int64Index([108], dtype='int64'),\n",
       " ('新加坡', '共享经济'): Int64Index([15], dtype='int64'),\n",
       " ('新加坡', '电子商务'): Int64Index([50], dtype='int64'),\n",
       " ('日本', '人工智能'): Int64Index([202], dtype='int64'),\n",
       " ('日本', '区块链'): Int64Index([388], dtype='int64'),\n",
       " ('法国', '人工智能'): Int64Index([396], dtype='int64'),\n",
       " ('法国', '健康科技'): Int64Index([320], dtype='int64'),\n",
       " ('法国', '共享经济'): Int64Index([149], dtype='int64'),\n",
       " ('法国', '媒体和娱乐'): Int64Index([317], dtype='int64'),\n",
       " ('澳大利亚', '云计算'): Int64Index([88], dtype='int64'),\n",
       " ('爱尔兰', '云计算'): Int64Index([182], dtype='int64'),\n",
       " ('爱沙尼亚', '共享经济'): Int64Index([290], dtype='int64'),\n",
       " ('瑞典', '新能源'): Int64Index([196], dtype='int64'),\n",
       " ('瑞典', '金融科技'): Int64Index([62], dtype='int64'),\n",
       " ('瑞士', '区块链'): Int64Index([167], dtype='int64'),\n",
       " ('瑞士', '生命科学'): Int64Index([36], dtype='int64'),\n",
       " ('瑞士', '虚拟与增强现实'): Int64Index([400], dtype='int64'),\n",
       " ('美国', '3D印刷'): Int64Index([155, 165, 335], dtype='int64'),\n",
       " ('美国',\n",
       "  '云计算'): Int64Index([  3,  70,  92, 119, 142, 170, 174, 180, 208, 209, 211, 212, 219,\n",
       "             270, 272, 282, 308, 319, 324, 329, 341, 357, 366, 367, 397, 405,\n",
       "             416, 417, 446, 460, 470, 474],\n",
       "            dtype='int64'),\n",
       " ('美国',\n",
       "  '人工智能'): Int64Index([ 33,  41,  84, 135, 138, 143, 161, 162, 179, 200, 216, 296, 307,\n",
       "             315, 436, 444, 450, 456, 463, 489],\n",
       "            dtype='int64'),\n",
       " ('美国',\n",
       "  '健康科技'): Int64Index([98, 112, 121, 166, 175, 210, 221, 277, 295, 298, 412, 424], dtype='int64'),\n",
       " ('美国', '共享经济'): Int64Index([5, 8, 40, 148, 186, 462], dtype='int64'),\n",
       " ('美国', '区块链'): Int64Index([29, 53, 90, 289], dtype='int64'),\n",
       " ('美国', '即时通讯'): Int64Index([168, 194, 362, 448, 452], dtype='int64'),\n",
       " ('美国',\n",
       "  '大数据'): Int64Index([17, 71, 94, 301, 309, 346, 394, 461], dtype='int64'),\n",
       " ('美国', '媒体和娱乐'): Int64Index([16, 117, 151, 204, 213, 471], dtype='int64'),\n",
       " ('美国', '房地产科技'): Int64Index([104, 115, 419, 443, 472], dtype='int64'),\n",
       " ('美国', '教育科技'): Int64Index([271, 312, 466], dtype='int64'),\n",
       " ('美国', '新能源'): Int64Index([302, 399, 435, 440, 469], dtype='int64'),\n",
       " ('美国', '新能源汽车'): Int64Index([54, 59, 406], dtype='int64'),\n",
       " ('美国', '新零售'): Int64Index([176, 276, 284, 300, 375, 447], dtype='int64'),\n",
       " ('美国', '机器人'): Int64Index([109], dtype='int64'),\n",
       " ('美国', '消费品'): Int64Index([4, 195, 198, 217, 343, 420, 455], dtype='int64'),\n",
       " ('美国', '游戏'): Int64Index([51, 118, 126, 140, 322], dtype='int64'),\n",
       " ('美国',\n",
       "  '物流'): Int64Index([18, 31, 97, 171, 201, 222, 311, 374, 492], dtype='int64'),\n",
       " ('美国',\n",
       "  '生命科学'): Int64Index([21, 30, 61, 68, 124, 137, 193, 264, 340, 355], dtype='int64'),\n",
       " ('美国',\n",
       "  '电子商务'): Int64Index([28, 57, 60, 67, 75, 280, 330, 331, 348, 382, 395, 409, 430, 445,\n",
       "             453, 457, 493],\n",
       "            dtype='int64'),\n",
       " ('美国', '网络安全'): Int64Index([38, 306, 360, 376, 391, 413], dtype='int64'),\n",
       " ('美国', '航天'): Int64Index([7, 111, 433], dtype='int64'),\n",
       " ('美国', '虚拟与增强现实'): Int64Index([44, 65], dtype='int64'),\n",
       " ('美国', '软件与服务'): Int64Index([203, 293, 316, 449], dtype='int64'),\n",
       " ('美国',\n",
       "  '金融科技'): Int64Index([  9,  32,  58,  72,  83,  86, 114, 125, 144, 156, 159, 173, 185,\n",
       "             188, 191, 283, 288, 373, 404, 426, 434],\n",
       "            dtype='int64'),\n",
       " ('芬兰', '消费品'): Int64Index([349], dtype='int64'),\n",
       " ('英国', '人工智能'): Int64Index([145, 172], dtype='int64'),\n",
       " ('英国', '新能源'): Int64Index([418], dtype='int64'),\n",
       " ('英国', '游戏'): Int64Index([177], dtype='int64'),\n",
       " ('英国', '物流'): Int64Index([164], dtype='int64'),\n",
       " ('英国', '生命科学'): Int64Index([197], dtype='int64'),\n",
       " ('英国', '电子商务'): Int64Index([55], dtype='int64'),\n",
       " ('英国', '金融科技'): Int64Index([73, 82, 107, 110, 157, 207], dtype='int64'),\n",
       " ('菲律宾', '房地产科技'): Int64Index([431], dtype='int64'),\n",
       " ('西班牙', '共享经济'): Int64Index([297], dtype='int64'),\n",
       " ('阿根廷', '云计算'): Int64Index([281], dtype='int64'),\n",
       " ('韩国', '游戏'): Int64Index([49], dtype='int64'),\n",
       " ('韩国', '物流'): Int64Index([129], dtype='int64'),\n",
       " ('韩国', '电子商务'): Int64Index([26, 458, 479], dtype='int64'),\n",
       " ('韩国', '金融科技'): Int64Index([459], dtype='int64'),\n",
       " ('马耳他', '区块链'): Int64Index([147], dtype='int64')}"
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b.groups"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4. 分进合击\n",
    "1. 分进合击——剑法：   \n",
    "   * 分 groupby   \n",
    "   * 进 count,mean,max,min,sum   \n",
    "   * 合 agg   \n",
    "2. 分进合击——科技心法   \n",
    "   * 分 split   \n",
    "   * 进 apply   \n",
    "   * 合 combine   \n",
    "3. 出报表——剑法   \n",
    "   * rename改名:修改列名称/索引名称   \n",
    "   * sort_values排序\n",
    "   * excel多分页法：with pd.ExcelWriter() as writer:/with open() as fp:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>企业名称</th>\n",
       "      <th colspan=\"2\" halign=\"left\">估值（亿人民币）</th>\n",
       "      <th colspan=\"2\" halign=\"left\">成立年份</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>数量</th>\n",
       "      <th>总和</th>\n",
       "      <th>均值</th>\n",
       "      <th>最早</th>\n",
       "      <th>最新</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th>行业</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">中国</th>\n",
       "      <th>金融科技</th>\n",
       "      <td>22</td>\n",
       "      <td>17960</td>\n",
       "      <td>816.363636</td>\n",
       "      <td>2002</td>\n",
       "      <td>2018</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>媒体和娱乐</th>\n",
       "      <td>17</td>\n",
       "      <td>8230</td>\n",
       "      <td>484.117647</td>\n",
       "      <td>2003</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">美国</th>\n",
       "      <th>云计算</th>\n",
       "      <td>32</td>\n",
       "      <td>6880</td>\n",
       "      <td>215.000000</td>\n",
       "      <td>2000</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <td>6</td>\n",
       "      <td>5670</td>\n",
       "      <td>945.000000</td>\n",
       "      <td>2008</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <td>21</td>\n",
       "      <td>5020</td>\n",
       "      <td>239.047619</td>\n",
       "      <td>2000</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">中国</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>8</td>\n",
       "      <td>4740</td>\n",
       "      <td>592.500000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>33</td>\n",
       "      <td>4220</td>\n",
       "      <td>127.878788</td>\n",
       "      <td>2005</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>消费品</th>\n",
       "      <td>7</td>\n",
       "      <td>4060</td>\n",
       "      <td>580.000000</td>\n",
       "      <td>2006</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>物流</th>\n",
       "      <td>16</td>\n",
       "      <td>3910</td>\n",
       "      <td>244.375000</td>\n",
       "      <td>2000</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">美国</th>\n",
       "      <th>人工智能</th>\n",
       "      <td>20</td>\n",
       "      <td>3080</td>\n",
       "      <td>154.000000</td>\n",
       "      <td>2003</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>航天</th>\n",
       "      <td>3</td>\n",
       "      <td>2770</td>\n",
       "      <td>923.333333</td>\n",
       "      <td>2002</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <td>10</td>\n",
       "      <td>2660</td>\n",
       "      <td>266.000000</td>\n",
       "      <td>2006</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>17</td>\n",
       "      <td>2640</td>\n",
       "      <td>155.294118</td>\n",
       "      <td>2007</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <td>9</td>\n",
       "      <td>2310</td>\n",
       "      <td>256.666667</td>\n",
       "      <td>2010</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">中国</th>\n",
       "      <th>人工智能</th>\n",
       "      <td>15</td>\n",
       "      <td>2090</td>\n",
       "      <td>139.333333</td>\n",
       "      <td>2009</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>健康科技</th>\n",
       "      <td>13</td>\n",
       "      <td>2060</td>\n",
       "      <td>158.461538</td>\n",
       "      <td>2000</td>\n",
       "      <td>2019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>大数据</th>\n",
       "      <td>8</td>\n",
       "      <td>1850</td>\n",
       "      <td>231.250000</td>\n",
       "      <td>2001</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>新能源汽车</th>\n",
       "      <td>12</td>\n",
       "      <td>1810</td>\n",
       "      <td>150.833333</td>\n",
       "      <td>2014</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">美国</th>\n",
       "      <th>媒体和娱乐</th>\n",
       "      <td>6</td>\n",
       "      <td>1720</td>\n",
       "      <td>286.666667</td>\n",
       "      <td>2003</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>健康科技</th>\n",
       "      <td>12</td>\n",
       "      <td>1550</td>\n",
       "      <td>129.166667</td>\n",
       "      <td>2001</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">中国</th>\n",
       "      <th>软件与服务</th>\n",
       "      <td>15</td>\n",
       "      <td>1460</td>\n",
       "      <td>97.333333</td>\n",
       "      <td>2001</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>机器人</th>\n",
       "      <td>3</td>\n",
       "      <td>1400</td>\n",
       "      <td>466.666667</td>\n",
       "      <td>2006</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>房地产科技</th>\n",
       "      <td>7</td>\n",
       "      <td>1340</td>\n",
       "      <td>191.428571</td>\n",
       "      <td>2010</td>\n",
       "      <td>2018</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>英国</th>\n",
       "      <th>金融科技</th>\n",
       "      <td>6</td>\n",
       "      <td>1250</td>\n",
       "      <td>208.333333</td>\n",
       "      <td>2011</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">中国</th>\n",
       "      <th>区块链</th>\n",
       "      <td>4</td>\n",
       "      <td>1250</td>\n",
       "      <td>312.500000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>教育科技</th>\n",
       "      <td>11</td>\n",
       "      <td>1190</td>\n",
       "      <td>108.181818</td>\n",
       "      <td>2001</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>区块链</th>\n",
       "      <td>4</td>\n",
       "      <td>1170</td>\n",
       "      <td>292.500000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新加坡</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>1</td>\n",
       "      <td>1000</td>\n",
       "      <td>1000.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>游戏</th>\n",
       "      <td>5</td>\n",
       "      <td>970</td>\n",
       "      <td>194.000000</td>\n",
       "      <td>2004</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>金融科技</th>\n",
       "      <td>3</td>\n",
       "      <td>920</td>\n",
       "      <td>306.666667</td>\n",
       "      <td>2000</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <th>软件与服务</th>\n",
       "      <td>1</td>\n",
       "      <td>150</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2002</td>\n",
       "      <td>2002</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞士</th>\n",
       "      <th>区块链</th>\n",
       "      <td>1</td>\n",
       "      <td>150</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日本</th>\n",
       "      <th>人工智能</th>\n",
       "      <td>1</td>\n",
       "      <td>150</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>大数据</th>\n",
       "      <td>1</td>\n",
       "      <td>150</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2004</td>\n",
       "      <td>2004</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>爱尔兰</th>\n",
       "      <th>云计算</th>\n",
       "      <td>1</td>\n",
       "      <td>150</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2000</td>\n",
       "      <td>2000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞典</th>\n",
       "      <th>新能源</th>\n",
       "      <td>1</td>\n",
       "      <td>150</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>新能源</th>\n",
       "      <td>2</td>\n",
       "      <td>140</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2006</td>\n",
       "      <td>2008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>巴西</th>\n",
       "      <th>物流</th>\n",
       "      <td>2</td>\n",
       "      <td>140</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>游戏</th>\n",
       "      <td>1</td>\n",
       "      <td>100</td>\n",
       "      <td>100.000000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <th>人工智能</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>即时通讯</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>阿根廷</th>\n",
       "      <th>云计算</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西班牙</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>菲律宾</th>\n",
       "      <th>房地产科技</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <th>生命科学</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>韩国</th>\n",
       "      <th>金融科技</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <th>电子商务</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞士</th>\n",
       "      <th>虚拟与增强现实</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>新零售</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>英国</th>\n",
       "      <th>新能源</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2009</td>\n",
       "      <td>2009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芬兰</th>\n",
       "      <th>消费品</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">印度</th>\n",
       "      <th>游戏</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>软件与服务</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2007</td>\n",
       "      <td>2007</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>哥伦比亚</th>\n",
       "      <th>物流</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>巴西</th>\n",
       "      <th>健康科技</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日本</th>\n",
       "      <th>区块链</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">法国</th>\n",
       "      <th>人工智能</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>媒体和娱乐</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2006</td>\n",
       "      <td>2006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>爱沙尼亚</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>法国</th>\n",
       "      <th>健康科技</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>103 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             企业名称 估值（亿人民币）               成立年份      \n",
       "               数量       总和           均值    最早    最新\n",
       "国家   行业                                            \n",
       "中国   金融科技      22    17960   816.363636  2002  2018\n",
       "     媒体和娱乐     17     8230   484.117647  2003  2015\n",
       "美国   云计算       32     6880   215.000000  2000  2015\n",
       "     共享经济       6     5670   945.000000  2008  2017\n",
       "     金融科技      21     5020   239.047619  2000  2017\n",
       "中国   共享经济       8     4740   592.500000  2011  2016\n",
       "     电子商务      33     4220   127.878788  2005  2015\n",
       "美国   消费品        7     4060   580.000000  2006  2017\n",
       "中国   物流        16     3910   244.375000  2000  2015\n",
       "美国   人工智能      20     3080   154.000000  2003  2016\n",
       "     航天         3     2770   923.333333  2002  2012\n",
       "     生命科学      10     2660   266.000000  2006  2016\n",
       "     电子商务      17     2640   155.294118  2007  2017\n",
       "     物流         9     2310   256.666667  2010  2015\n",
       "中国   人工智能      15     2090   139.333333  2009  2016\n",
       "     健康科技      13     2060   158.461538  2000  2019\n",
       "美国   大数据        8     1850   231.250000  2001  2013\n",
       "中国   新能源汽车     12     1810   150.833333  2014  2017\n",
       "美国   媒体和娱乐      6     1720   286.666667  2003  2014\n",
       "     健康科技      12     1550   129.166667  2001  2017\n",
       "中国   软件与服务     15     1460    97.333333  2001  2014\n",
       "     机器人        3     1400   466.666667  2006  2013\n",
       "     房地产科技      7     1340   191.428571  2010  2018\n",
       "英国   金融科技       6     1250   208.333333  2011  2015\n",
       "中国   区块链        4     1250   312.500000  2013  2017\n",
       "     教育科技      11     1190   108.181818  2001  2014\n",
       "美国   区块链        4     1170   292.500000  2011  2013\n",
       "新加坡  共享经济       1     1000  1000.000000  2012  2012\n",
       "美国   游戏         5      970   194.000000  2004  2012\n",
       "印度   金融科技       3      920   306.666667  2000  2010\n",
       "...           ...      ...          ...   ...   ...\n",
       "以色列  软件与服务      1      150   150.000000  2002  2002\n",
       "瑞士   区块链        1      150   150.000000  2015  2015\n",
       "日本   人工智能       1      150   150.000000  2014  2014\n",
       "印度   大数据        1      150   150.000000  2004  2004\n",
       "爱尔兰  云计算        1      150   150.000000  2000  2000\n",
       "瑞典   新能源        1      150   150.000000  2016  2016\n",
       "中国   新能源        2      140    70.000000  2006  2008\n",
       "巴西   物流         2      140    70.000000  2011  2013\n",
       "中国   游戏         1      100   100.000000  2015  2015\n",
       "以色列  人工智能       1       70    70.000000  2010  2010\n",
       "印度   即时通讯       1       70    70.000000  2012  2012\n",
       "阿根廷  云计算        1       70    70.000000  2013  2013\n",
       "西班牙  共享经济       1       70    70.000000  2011  2011\n",
       "菲律宾  房地产科技      1       70    70.000000  2015  2015\n",
       "以色列  生命科学       1       70    70.000000  2010  2010\n",
       "韩国   金融科技       1       70    70.000000  2011  2011\n",
       "卢森堡  电子商务       1       70    70.000000  2014  2014\n",
       "瑞士   虚拟与增强现实    1       70    70.000000  2012  2012\n",
       "印度   新零售        1       70    70.000000  2011  2011\n",
       "英国   新能源        1       70    70.000000  2009  2009\n",
       "芬兰   消费品        1       70    70.000000  2016  2016\n",
       "印度   游戏         1       70    70.000000  2012  2012\n",
       "     软件与服务      1       70    70.000000  2007  2007\n",
       "哥伦比亚 物流         1       70    70.000000  2016  2016\n",
       "巴西   健康科技       1       70    70.000000  2012  2012\n",
       "日本   区块链        1       70    70.000000  2014  2014\n",
       "法国   人工智能       1       70    70.000000  2016  2016\n",
       "     媒体和娱乐      1       70    70.000000  2006  2006\n",
       "爱沙尼亚 共享经济       1       70    70.000000  2013  2013\n",
       "法国   健康科技       1       70    70.000000  2013  2013\n",
       "\n",
       "[103 rows x 5 columns]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "country_first = df.groupby(by = [\"国家\",\"行业\"]) \\\n",
    "                  .agg({\"企业名称\":\"count\",\"估值（亿人民币）\":[\"sum\",\"mean\"], \"成立年份\":[\"min\",\"max\"],}) \\\n",
    "                  .sort_values(by=[(\"估值（亿人民币）\",\"sum\")],ascending = False) \\\n",
    "                  .rename(columns = {\"sum\":\"总和\",\"mean\":\"均值\",\"count\":\"数量\",\"max\":\"最新\",\"min\":\"最早\"})\n",
    "display(country_first)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>企业名称</th>\n",
       "      <th colspan=\"2\" halign=\"left\">估值（亿人民币）</th>\n",
       "      <th colspan=\"2\" halign=\"left\">成立年份</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>数量</th>\n",
       "      <th>总和</th>\n",
       "      <th>均值</th>\n",
       "      <th>最早</th>\n",
       "      <th>最新</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>行业</th>\n",
       "      <th>国家</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <th>中国</th>\n",
       "      <td>22</td>\n",
       "      <td>17960</td>\n",
       "      <td>816.363636</td>\n",
       "      <td>2002</td>\n",
       "      <td>2018</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>媒体和娱乐</th>\n",
       "      <th>中国</th>\n",
       "      <td>17</td>\n",
       "      <td>8230</td>\n",
       "      <td>484.117647</td>\n",
       "      <td>2003</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>云计算</th>\n",
       "      <th>美国</th>\n",
       "      <td>32</td>\n",
       "      <td>6880</td>\n",
       "      <td>215.000000</td>\n",
       "      <td>2000</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <th>美国</th>\n",
       "      <td>6</td>\n",
       "      <td>5670</td>\n",
       "      <td>945.000000</td>\n",
       "      <td>2008</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <th>美国</th>\n",
       "      <td>21</td>\n",
       "      <td>5020</td>\n",
       "      <td>239.047619</td>\n",
       "      <td>2000</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <th>中国</th>\n",
       "      <td>8</td>\n",
       "      <td>4740</td>\n",
       "      <td>592.500000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <th>中国</th>\n",
       "      <td>33</td>\n",
       "      <td>4220</td>\n",
       "      <td>127.878788</td>\n",
       "      <td>2005</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>消费品</th>\n",
       "      <th>美国</th>\n",
       "      <td>7</td>\n",
       "      <td>4060</td>\n",
       "      <td>580.000000</td>\n",
       "      <td>2006</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <th>中国</th>\n",
       "      <td>16</td>\n",
       "      <td>3910</td>\n",
       "      <td>244.375000</td>\n",
       "      <td>2000</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <th>美国</th>\n",
       "      <td>20</td>\n",
       "      <td>3080</td>\n",
       "      <td>154.000000</td>\n",
       "      <td>2003</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>航天</th>\n",
       "      <th>美国</th>\n",
       "      <td>3</td>\n",
       "      <td>2770</td>\n",
       "      <td>923.333333</td>\n",
       "      <td>2002</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <th>美国</th>\n",
       "      <td>10</td>\n",
       "      <td>2660</td>\n",
       "      <td>266.000000</td>\n",
       "      <td>2006</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <th>美国</th>\n",
       "      <td>17</td>\n",
       "      <td>2640</td>\n",
       "      <td>155.294118</td>\n",
       "      <td>2007</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <th>美国</th>\n",
       "      <td>9</td>\n",
       "      <td>2310</td>\n",
       "      <td>256.666667</td>\n",
       "      <td>2010</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <th>中国</th>\n",
       "      <td>15</td>\n",
       "      <td>2090</td>\n",
       "      <td>139.333333</td>\n",
       "      <td>2009</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>健康科技</th>\n",
       "      <th>中国</th>\n",
       "      <td>13</td>\n",
       "      <td>2060</td>\n",
       "      <td>158.461538</td>\n",
       "      <td>2000</td>\n",
       "      <td>2019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>大数据</th>\n",
       "      <th>美国</th>\n",
       "      <td>8</td>\n",
       "      <td>1850</td>\n",
       "      <td>231.250000</td>\n",
       "      <td>2001</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新能源汽车</th>\n",
       "      <th>中国</th>\n",
       "      <td>12</td>\n",
       "      <td>1810</td>\n",
       "      <td>150.833333</td>\n",
       "      <td>2014</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>媒体和娱乐</th>\n",
       "      <th>美国</th>\n",
       "      <td>6</td>\n",
       "      <td>1720</td>\n",
       "      <td>286.666667</td>\n",
       "      <td>2003</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>健康科技</th>\n",
       "      <th>美国</th>\n",
       "      <td>12</td>\n",
       "      <td>1550</td>\n",
       "      <td>129.166667</td>\n",
       "      <td>2001</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>软件与服务</th>\n",
       "      <th>中国</th>\n",
       "      <td>15</td>\n",
       "      <td>1460</td>\n",
       "      <td>97.333333</td>\n",
       "      <td>2001</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>机器人</th>\n",
       "      <th>中国</th>\n",
       "      <td>3</td>\n",
       "      <td>1400</td>\n",
       "      <td>466.666667</td>\n",
       "      <td>2006</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>房地产科技</th>\n",
       "      <th>中国</th>\n",
       "      <td>7</td>\n",
       "      <td>1340</td>\n",
       "      <td>191.428571</td>\n",
       "      <td>2010</td>\n",
       "      <td>2018</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <th>英国</th>\n",
       "      <td>6</td>\n",
       "      <td>1250</td>\n",
       "      <td>208.333333</td>\n",
       "      <td>2011</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>区块链</th>\n",
       "      <th>中国</th>\n",
       "      <td>4</td>\n",
       "      <td>1250</td>\n",
       "      <td>312.500000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>教育科技</th>\n",
       "      <th>中国</th>\n",
       "      <td>11</td>\n",
       "      <td>1190</td>\n",
       "      <td>108.181818</td>\n",
       "      <td>2001</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>区块链</th>\n",
       "      <th>美国</th>\n",
       "      <td>4</td>\n",
       "      <td>1170</td>\n",
       "      <td>292.500000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <th>新加坡</th>\n",
       "      <td>1</td>\n",
       "      <td>1000</td>\n",
       "      <td>1000.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>游戏</th>\n",
       "      <th>美国</th>\n",
       "      <td>5</td>\n",
       "      <td>970</td>\n",
       "      <td>194.000000</td>\n",
       "      <td>2004</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <th>印度</th>\n",
       "      <td>3</td>\n",
       "      <td>920</td>\n",
       "      <td>306.666667</td>\n",
       "      <td>2000</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <th>德国</th>\n",
       "      <td>1</td>\n",
       "      <td>150</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2000</td>\n",
       "      <td>2000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>大数据</th>\n",
       "      <th>印度</th>\n",
       "      <td>1</td>\n",
       "      <td>150</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2004</td>\n",
       "      <td>2004</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>软件与服务</th>\n",
       "      <th>以色列</th>\n",
       "      <td>1</td>\n",
       "      <td>150</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2002</td>\n",
       "      <td>2002</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>游戏</th>\n",
       "      <th>英国</th>\n",
       "      <td>1</td>\n",
       "      <td>150</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>区块链</th>\n",
       "      <th>马耳他</th>\n",
       "      <td>1</td>\n",
       "      <td>150</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <th>日本</th>\n",
       "      <td>1</td>\n",
       "      <td>150</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新能源</th>\n",
       "      <th>中国</th>\n",
       "      <td>2</td>\n",
       "      <td>140</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2006</td>\n",
       "      <td>2008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <th>巴西</th>\n",
       "      <td>2</td>\n",
       "      <td>140</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>游戏</th>\n",
       "      <th>中国</th>\n",
       "      <td>1</td>\n",
       "      <td>100</td>\n",
       "      <td>100.000000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>软件与服务</th>\n",
       "      <th>印度</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2007</td>\n",
       "      <td>2007</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <th>以色列</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>云计算</th>\n",
       "      <th>阿根廷</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <th>法国</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>虚拟与增强现实</th>\n",
       "      <th>瑞士</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新零售</th>\n",
       "      <th>印度</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <th>卢森堡</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">健康科技</th>\n",
       "      <th>巴西</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>法国</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">共享经济</th>\n",
       "      <th>爱沙尼亚</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西班牙</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>区块链</th>\n",
       "      <th>日本</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新能源</th>\n",
       "      <th>英国</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2009</td>\n",
       "      <td>2009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>即时通讯</th>\n",
       "      <th>印度</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <th>以色列</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>媒体和娱乐</th>\n",
       "      <th>法国</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2006</td>\n",
       "      <td>2006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>房地产科技</th>\n",
       "      <th>菲律宾</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <th>哥伦比亚</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>游戏</th>\n",
       "      <th>印度</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>消费品</th>\n",
       "      <th>芬兰</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <th>韩国</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>103 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             企业名称 估值（亿人民币）               成立年份      \n",
       "               数量       总和           均值    最早    最新\n",
       "行业      国家                                         \n",
       "金融科技    中国     22    17960   816.363636  2002  2018\n",
       "媒体和娱乐   中国     17     8230   484.117647  2003  2015\n",
       "云计算     美国     32     6880   215.000000  2000  2015\n",
       "共享经济    美国      6     5670   945.000000  2008  2017\n",
       "金融科技    美国     21     5020   239.047619  2000  2017\n",
       "共享经济    中国      8     4740   592.500000  2011  2016\n",
       "电子商务    中国     33     4220   127.878788  2005  2015\n",
       "消费品     美国      7     4060   580.000000  2006  2017\n",
       "物流      中国     16     3910   244.375000  2000  2015\n",
       "人工智能    美国     20     3080   154.000000  2003  2016\n",
       "航天      美国      3     2770   923.333333  2002  2012\n",
       "生命科学    美国     10     2660   266.000000  2006  2016\n",
       "电子商务    美国     17     2640   155.294118  2007  2017\n",
       "物流      美国      9     2310   256.666667  2010  2015\n",
       "人工智能    中国     15     2090   139.333333  2009  2016\n",
       "健康科技    中国     13     2060   158.461538  2000  2019\n",
       "大数据     美国      8     1850   231.250000  2001  2013\n",
       "新能源汽车   中国     12     1810   150.833333  2014  2017\n",
       "媒体和娱乐   美国      6     1720   286.666667  2003  2014\n",
       "健康科技    美国     12     1550   129.166667  2001  2017\n",
       "软件与服务   中国     15     1460    97.333333  2001  2014\n",
       "机器人     中国      3     1400   466.666667  2006  2013\n",
       "房地产科技   中国      7     1340   191.428571  2010  2018\n",
       "金融科技    英国      6     1250   208.333333  2011  2015\n",
       "区块链     中国      4     1250   312.500000  2013  2017\n",
       "教育科技    中国     11     1190   108.181818  2001  2014\n",
       "区块链     美国      4     1170   292.500000  2011  2013\n",
       "共享经济    新加坡     1     1000  1000.000000  2012  2012\n",
       "游戏      美国      5      970   194.000000  2004  2012\n",
       "金融科技    印度      3      920   306.666667  2000  2010\n",
       "...           ...      ...          ...   ...   ...\n",
       "生命科学    德国      1      150   150.000000  2000  2000\n",
       "大数据     印度      1      150   150.000000  2004  2004\n",
       "软件与服务   以色列     1      150   150.000000  2002  2002\n",
       "游戏      英国      1      150   150.000000  2012  2012\n",
       "区块链     马耳他     1      150   150.000000  2017  2017\n",
       "人工智能    日本      1      150   150.000000  2014  2014\n",
       "新能源     中国      2      140    70.000000  2006  2008\n",
       "物流      巴西      2      140    70.000000  2011  2013\n",
       "游戏      中国      1      100   100.000000  2015  2015\n",
       "软件与服务   印度      1       70    70.000000  2007  2007\n",
       "人工智能    以色列     1       70    70.000000  2010  2010\n",
       "云计算     阿根廷     1       70    70.000000  2013  2013\n",
       "人工智能    法国      1       70    70.000000  2016  2016\n",
       "虚拟与增强现实 瑞士      1       70    70.000000  2012  2012\n",
       "新零售     印度      1       70    70.000000  2011  2011\n",
       "电子商务    卢森堡     1       70    70.000000  2014  2014\n",
       "健康科技    巴西      1       70    70.000000  2012  2012\n",
       "        法国      1       70    70.000000  2013  2013\n",
       "共享经济    爱沙尼亚    1       70    70.000000  2013  2013\n",
       "        西班牙     1       70    70.000000  2011  2011\n",
       "区块链     日本      1       70    70.000000  2014  2014\n",
       "新能源     英国      1       70    70.000000  2009  2009\n",
       "即时通讯    印度      1       70    70.000000  2012  2012\n",
       "生命科学    以色列     1       70    70.000000  2010  2010\n",
       "媒体和娱乐   法国      1       70    70.000000  2006  2006\n",
       "房地产科技   菲律宾     1       70    70.000000  2015  2015\n",
       "物流      哥伦比亚    1       70    70.000000  2016  2016\n",
       "游戏      印度      1       70    70.000000  2012  2012\n",
       "消费品     芬兰      1       70    70.000000  2016  2016\n",
       "金融科技    韩国      1       70    70.000000  2011  2011\n",
       "\n",
       "[103 rows x 5 columns]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "vary_first = df.groupby(by = [\"行业\",\"国家\"]) \\\n",
    "                  .agg({\"企业名称\":\"count\",\"估值（亿人民币）\":[\"sum\",\"mean\"], \"成立年份\":[\"min\",\"max\"],}) \\\n",
    "                  .sort_values(by=[(\"估值（亿人民币）\",\"sum\")],ascending = False) \\\n",
    "                  .rename(columns = {\"sum\":\"总和\",\"mean\":\"均值\",\"count\":\"数量\",\"max\":\"最新\",\"min\":\"最早\"})\n",
    "display(vary_first)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [],
   "source": [
    "# excel多分页法：\n",
    "with pd.ExcelWriter(\"练习excel分页.xlsx\") as writer:\n",
    "    country_first.to_excel(writer,sheet_name=\"country_first\")\n",
    "    vary_first.to_excel(writer,sheet_name=\"vary_first\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>企业名称</th>\n",
       "      <th colspan=\"2\" halign=\"left\">估值（亿人民币）</th>\n",
       "      <th colspan=\"2\" halign=\"left\">成立年份</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>数量</th>\n",
       "      <th>总和</th>\n",
       "      <th>均值</th>\n",
       "      <th>最早</th>\n",
       "      <th>最新</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>行业</th>\n",
       "      <th>城市</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <th>杭州</th>\n",
       "      <td>4</td>\n",
       "      <td>10290</td>\n",
       "      <td>2572.500000</td>\n",
       "      <td>2009</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>航天</th>\n",
       "      <th>洛杉矶</th>\n",
       "      <td>1</td>\n",
       "      <td>2500</td>\n",
       "      <td>2500.000000</td>\n",
       "      <td>2002</td>\n",
       "      <td>2002</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <th>纽约</th>\n",
       "      <td>1</td>\n",
       "      <td>2100</td>\n",
       "      <td>2100.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>消费品</th>\n",
       "      <th>旧金山</th>\n",
       "      <td>2</td>\n",
       "      <td>3550</td>\n",
       "      <td>1775.000000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <th>旧金山</th>\n",
       "      <td>2</td>\n",
       "      <td>2770</td>\n",
       "      <td>1385.000000</td>\n",
       "      <td>2008</td>\n",
       "      <td>2009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <th>杭州</th>\n",
       "      <td>1</td>\n",
       "      <td>1300</td>\n",
       "      <td>1300.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>媒体和娱乐</th>\n",
       "      <th>洛杉矶</th>\n",
       "      <td>1</td>\n",
       "      <td>1000</td>\n",
       "      <td>1000.000000</td>\n",
       "      <td>2007</td>\n",
       "      <td>2007</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>大数据</th>\n",
       "      <th>帕洛阿尔托</th>\n",
       "      <td>1</td>\n",
       "      <td>1000</td>\n",
       "      <td>1000.000000</td>\n",
       "      <td>2004</td>\n",
       "      <td>2004</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <th>新加坡</th>\n",
       "      <td>1</td>\n",
       "      <td>1000</td>\n",
       "      <td>1000.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>云计算</th>\n",
       "      <th>纽约</th>\n",
       "      <td>4</td>\n",
       "      <td>3950</td>\n",
       "      <td>987.500000</td>\n",
       "      <td>2002</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>媒体和娱乐</th>\n",
       "      <th>北京</th>\n",
       "      <td>7</td>\n",
       "      <td>6890</td>\n",
       "      <td>984.285714</td>\n",
       "      <td>2003</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <th>上海</th>\n",
       "      <td>4</td>\n",
       "      <td>3470</td>\n",
       "      <td>867.500000</td>\n",
       "      <td>2002</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <th>北京</th>\n",
       "      <td>5</td>\n",
       "      <td>4040</td>\n",
       "      <td>808.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>区块链</th>\n",
       "      <th>北京</th>\n",
       "      <td>1</td>\n",
       "      <td>800</td>\n",
       "      <td>800.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <th>雅加达</th>\n",
       "      <td>1</td>\n",
       "      <td>700</td>\n",
       "      <td>700.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <th>诺伊达</th>\n",
       "      <td>1</td>\n",
       "      <td>700</td>\n",
       "      <td>700.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>机器人</th>\n",
       "      <th>深圳</th>\n",
       "      <td>2</td>\n",
       "      <td>1300</td>\n",
       "      <td>650.000000</td>\n",
       "      <td>2006</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>房地产科技</th>\n",
       "      <th>天津</th>\n",
       "      <td>1</td>\n",
       "      <td>600</td>\n",
       "      <td>600.000000</td>\n",
       "      <td>2018</td>\n",
       "      <td>2018</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <th>门洛帕克</th>\n",
       "      <td>1</td>\n",
       "      <td>550</td>\n",
       "      <td>550.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <th>门洛帕克</th>\n",
       "      <td>1</td>\n",
       "      <td>550</td>\n",
       "      <td>550.000000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <th>深圳</th>\n",
       "      <td>3</td>\n",
       "      <td>1640</td>\n",
       "      <td>546.666667</td>\n",
       "      <td>2014</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <th>匹兹堡</th>\n",
       "      <td>1</td>\n",
       "      <td>500</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <th>Harrisburg</th>\n",
       "      <td>1</td>\n",
       "      <td>500</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <th>巴塞尔</th>\n",
       "      <td>1</td>\n",
       "      <td>500</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <th>南京</th>\n",
       "      <td>1</td>\n",
       "      <td>500</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>2006</td>\n",
       "      <td>2006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>网络安全</th>\n",
       "      <th>Emerville</th>\n",
       "      <td>1</td>\n",
       "      <td>500</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>2007</td>\n",
       "      <td>2007</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <th>圣地亚哥</th>\n",
       "      <td>2</td>\n",
       "      <td>870</td>\n",
       "      <td>435.000000</td>\n",
       "      <td>2008</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>虚拟与增强现实</th>\n",
       "      <th>Plantation</th>\n",
       "      <td>1</td>\n",
       "      <td>400</td>\n",
       "      <td>400.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>教育科技</th>\n",
       "      <th>班加罗尔</th>\n",
       "      <td>1</td>\n",
       "      <td>400</td>\n",
       "      <td>400.000000</td>\n",
       "      <td>2008</td>\n",
       "      <td>2008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <th>贵阳</th>\n",
       "      <td>1</td>\n",
       "      <td>400</td>\n",
       "      <td>400.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <th>北京</th>\n",
       "      <td>2</td>\n",
       "      <td>140</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2007</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>健康科技</th>\n",
       "      <th>Guilford</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <th>雷德伍德城</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2009</td>\n",
       "      <td>2009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <th>普莱森顿</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <th>耶路撒冷</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>即时通讯</th>\n",
       "      <th>帕洛阿尔托</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <th>特拉维夫</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">人工智能</th>\n",
       "      <th>深圳</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>波士顿</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>森尼维耳市</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">电子商务</th>\n",
       "      <th>卢森堡</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>古尔冈</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>健康科技</th>\n",
       "      <th>巴黎</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <th>西雅图</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">健康科技</th>\n",
       "      <th>广州</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>旧金山</th>\n",
       "      <td>2</td>\n",
       "      <td>140</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2007</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">物流</th>\n",
       "      <th>波哥大</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣保罗</th>\n",
       "      <td>2</td>\n",
       "      <td>140</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>半月湾</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <th>塔林</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">游戏</th>\n",
       "      <th>波士顿</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>孟买</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <th>马德里</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>区块链</th>\n",
       "      <th>东京</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">消费品</th>\n",
       "      <th>赫尔辛基</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>纽约</th>\n",
       "      <td>2</td>\n",
       "      <td>140</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣塔莫尼卡</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>北京</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>即时通讯</th>\n",
       "      <th>山景城</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2009</td>\n",
       "      <td>2009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <th>香港</th>\n",
       "      <td>2</td>\n",
       "      <td>140</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>298 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                   企业名称 估值（亿人民币）               成立年份      \n",
       "                     数量       总和           均值    最早    最新\n",
       "行业      城市                                               \n",
       "金融科技    杭州            4    10290  2572.500000  2009  2015\n",
       "航天      洛杉矶           1     2500  2500.000000  2002  2002\n",
       "共享经济    纽约            1     2100  2100.000000  2010  2010\n",
       "消费品     旧金山           2     3550  1775.000000  2015  2017\n",
       "共享经济    旧金山           2     2770  1385.000000  2008  2009\n",
       "物流      杭州            1     1300  1300.000000  2013  2013\n",
       "媒体和娱乐   洛杉矶           1     1000  1000.000000  2007  2007\n",
       "大数据     帕洛阿尔托         1     1000  1000.000000  2004  2004\n",
       "共享经济    新加坡           1     1000  1000.000000  2012  2012\n",
       "云计算     纽约            4     3950   987.500000  2002  2011\n",
       "媒体和娱乐   北京            7     6890   984.285714  2003  2013\n",
       "金融科技    上海            4     3470   867.500000  2002  2015\n",
       "共享经济    北京            5     4040   808.000000  2011  2016\n",
       "区块链     北京            1      800   800.000000  2013  2013\n",
       "共享经济    雅加达           1      700   700.000000  2010  2010\n",
       "金融科技    诺伊达           1      700   700.000000  2010  2010\n",
       "机器人     深圳            2     1300   650.000000  2006  2012\n",
       "房地产科技   天津            1      600   600.000000  2018  2018\n",
       "金融科技    门洛帕克          1      550   550.000000  2013  2013\n",
       "生命科学    门洛帕克          1      550   550.000000  2016  2016\n",
       "金融科技    深圳            3     1640   546.666667  2014  2016\n",
       "共享经济    匹兹堡           1      500   500.000000  2015  2015\n",
       "人工智能    Harrisburg    1      500   500.000000  2016  2016\n",
       "生命科学    巴塞尔           1      500   500.000000  2014  2014\n",
       "金融科技    南京            1      500   500.000000  2006  2006\n",
       "网络安全    Emerville     1      500   500.000000  2007  2007\n",
       "生命科学    圣地亚哥          2      870   435.000000  2008  2013\n",
       "虚拟与增强现实 Plantation    1      400   400.000000  2011  2011\n",
       "教育科技    班加罗尔          1      400   400.000000  2008  2008\n",
       "物流      贵阳            1      400   400.000000  2014  2014\n",
       "...                 ...      ...          ...   ...   ...\n",
       "生命科学    北京            2      140    70.000000  2007  2011\n",
       "健康科技    Guilford      1       70    70.000000  2011  2011\n",
       "人工智能    雷德伍德城         1       70    70.000000  2009  2009\n",
       "生命科学    普莱森顿          1       70    70.000000  2012  2012\n",
       "人工智能    耶路撒冷          1       70    70.000000  2010  2010\n",
       "即时通讯    帕洛阿尔托         1       70    70.000000  2014  2014\n",
       "生命科学    特拉维夫          1       70    70.000000  2010  2010\n",
       "人工智能    深圳            1       70    70.000000  2013  2013\n",
       "        波士顿           1       70    70.000000  2012  2012\n",
       "        森尼维耳市         1       70    70.000000  2012  2012\n",
       "电子商务    卢森堡           1       70    70.000000  2014  2014\n",
       "        古尔冈           1       70    70.000000  2011  2011\n",
       "健康科技    巴黎            1       70    70.000000  2013  2013\n",
       "物流      西雅图           1       70    70.000000  2015  2015\n",
       "健康科技    广州            1       70    70.000000  2015  2015\n",
       "        旧金山           2      140    70.000000  2007  2012\n",
       "物流      波哥大           1       70    70.000000  2016  2016\n",
       "        圣保罗           2      140    70.000000  2011  2013\n",
       "        半月湾           1       70    70.000000  2014  2014\n",
       "共享经济    塔林            1       70    70.000000  2013  2013\n",
       "游戏      波士顿           1       70    70.000000  2012  2012\n",
       "        孟买            1       70    70.000000  2012  2012\n",
       "共享经济    马德里           1       70    70.000000  2011  2011\n",
       "区块链     东京            1       70    70.000000  2014  2014\n",
       "消费品     赫尔辛基          1       70    70.000000  2016  2016\n",
       "        纽约            2      140    70.000000  2014  2015\n",
       "        圣塔莫尼卡         1       70    70.000000  2012  2012\n",
       "        北京            1       70    70.000000  2014  2014\n",
       "即时通讯    山景城           1       70    70.000000  2009  2009\n",
       "金融科技    香港            2      140    70.000000  2013  2016\n",
       "\n",
       "[298 rows x 5 columns]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>企业名称</th>\n",
       "      <th colspan=\"2\" halign=\"left\">估值（亿人民币）</th>\n",
       "      <th colspan=\"2\" halign=\"left\">成立年份</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>数量</th>\n",
       "      <th>总和</th>\n",
       "      <th>均值</th>\n",
       "      <th>最早</th>\n",
       "      <th>最新</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th>城市</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>洛杉矶</th>\n",
       "      <td>3</td>\n",
       "      <td>3570</td>\n",
       "      <td>1190.000000</td>\n",
       "      <td>2002</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>杭州</th>\n",
       "      <td>19</td>\n",
       "      <td>13290</td>\n",
       "      <td>699.473684</td>\n",
       "      <td>2000</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新加坡</th>\n",
       "      <th>新加坡</th>\n",
       "      <td>2</td>\n",
       "      <td>1350</td>\n",
       "      <td>675.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>Emerville</th>\n",
       "      <td>1</td>\n",
       "      <td>500</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>2007</td>\n",
       "      <td>2007</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞士</th>\n",
       "      <th>巴塞尔</th>\n",
       "      <td>1</td>\n",
       "      <td>500</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">美国</th>\n",
       "      <th>Harrisburg</th>\n",
       "      <td>1</td>\n",
       "      <td>500</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>匹兹堡</th>\n",
       "      <td>1</td>\n",
       "      <td>500</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>诺伊达</th>\n",
       "      <td>2</td>\n",
       "      <td>900</td>\n",
       "      <td>450.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">美国</th>\n",
       "      <th>门洛帕克</th>\n",
       "      <td>3</td>\n",
       "      <td>1300</td>\n",
       "      <td>433.333333</td>\n",
       "      <td>2013</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Plantation</th>\n",
       "      <td>1</td>\n",
       "      <td>400</td>\n",
       "      <td>400.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>贵阳</th>\n",
       "      <td>1</td>\n",
       "      <td>400</td>\n",
       "      <td>400.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度尼西亚</th>\n",
       "      <th>雅加达</th>\n",
       "      <td>4</td>\n",
       "      <td>1570</td>\n",
       "      <td>392.500000</td>\n",
       "      <td>2009</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>天津</th>\n",
       "      <td>3</td>\n",
       "      <td>1100</td>\n",
       "      <td>366.666667</td>\n",
       "      <td>2013</td>\n",
       "      <td>2018</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>普利茅斯</th>\n",
       "      <td>1</td>\n",
       "      <td>350</td>\n",
       "      <td>350.000000</td>\n",
       "      <td>2009</td>\n",
       "      <td>2009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>英国</th>\n",
       "      <th>曼彻斯特</th>\n",
       "      <td>1</td>\n",
       "      <td>350</td>\n",
       "      <td>350.000000</td>\n",
       "      <td>2004</td>\n",
       "      <td>2004</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>韩国</th>\n",
       "      <th>城南市</th>\n",
       "      <td>1</td>\n",
       "      <td>350</td>\n",
       "      <td>350.000000</td>\n",
       "      <td>2007</td>\n",
       "      <td>2007</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">美国</th>\n",
       "      <th>纽约</th>\n",
       "      <td>25</td>\n",
       "      <td>8640</td>\n",
       "      <td>345.600000</td>\n",
       "      <td>2002</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>旧金山</th>\n",
       "      <td>55</td>\n",
       "      <td>17060</td>\n",
       "      <td>310.181818</td>\n",
       "      <td>2004</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>加迪纳</th>\n",
       "      <td>1</td>\n",
       "      <td>300</td>\n",
       "      <td>300.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>达拉斯</th>\n",
       "      <td>1</td>\n",
       "      <td>300</td>\n",
       "      <td>300.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>帕洛阿尔托</th>\n",
       "      <td>10</td>\n",
       "      <td>2740</td>\n",
       "      <td>274.000000</td>\n",
       "      <td>2004</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">中国</th>\n",
       "      <th>北京</th>\n",
       "      <td>81</td>\n",
       "      <td>22130</td>\n",
       "      <td>273.209877</td>\n",
       "      <td>2001</td>\n",
       "      <td>2019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>深圳</th>\n",
       "      <td>17</td>\n",
       "      <td>4440</td>\n",
       "      <td>261.176471</td>\n",
       "      <td>2006</td>\n",
       "      <td>2018</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>圣地亚哥</th>\n",
       "      <td>4</td>\n",
       "      <td>1010</td>\n",
       "      <td>252.500000</td>\n",
       "      <td>2008</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞典</th>\n",
       "      <th>斯德哥尔摩</th>\n",
       "      <td>2</td>\n",
       "      <td>450</td>\n",
       "      <td>225.000000</td>\n",
       "      <td>2005</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">美国</th>\n",
       "      <th>坎布里奇</th>\n",
       "      <td>2</td>\n",
       "      <td>450</td>\n",
       "      <td>225.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣马特奥</th>\n",
       "      <td>3</td>\n",
       "      <td>650</td>\n",
       "      <td>216.666667</td>\n",
       "      <td>2004</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>韩国</th>\n",
       "      <th>首尔</th>\n",
       "      <td>5</td>\n",
       "      <td>1010</td>\n",
       "      <td>202.000000</td>\n",
       "      <td>2005</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>Foster City</th>\n",
       "      <td>1</td>\n",
       "      <td>200</td>\n",
       "      <td>200.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>澳大利亚</th>\n",
       "      <th>悉尼</th>\n",
       "      <td>1</td>\n",
       "      <td>200</td>\n",
       "      <td>200.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>阿拉米达</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>无锡</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>罗利</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>菲律宾</th>\n",
       "      <th>马卡迪</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芬兰</th>\n",
       "      <th>赫尔辛基</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <th>耐斯兹敖那</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>金华</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">美国</th>\n",
       "      <th>盐湖城</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2008</td>\n",
       "      <td>2008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Guilford</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>爱沙尼亚</th>\n",
       "      <th>塔林</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">美国</th>\n",
       "      <th>Stafford</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2006</td>\n",
       "      <td>2006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>克利尔沃特</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>德国</th>\n",
       "      <th>汉堡</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">美国</th>\n",
       "      <th>哥伦布</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣克拉拉</th>\n",
       "      <td>2</td>\n",
       "      <td>140</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2005</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣卡洛斯</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2001</td>\n",
       "      <td>2001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>哥伦比亚</th>\n",
       "      <th>波哥大</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>新德里</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">美国</th>\n",
       "      <th>坎贝尔</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2007</td>\n",
       "      <td>2007</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>埃尔塞贡多</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>夏洛特市</th>\n",
       "      <td>2</td>\n",
       "      <td>140</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2000</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>孟买</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>尔湾</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <th>卢森堡</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>底特律</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <th>耶路撒冷</th>\n",
       "      <td>2</td>\n",
       "      <td>140</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞士</th>\n",
       "      <th>洛桑市</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">美国</th>\n",
       "      <th>普莱森顿</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>杭廷顿海滩</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2006</td>\n",
       "      <td>2006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>半月湾</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>121 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                  企业名称 估值（亿人民币）               成立年份      \n",
       "                    数量       总和           均值    最早    最新\n",
       "国家    城市                                                \n",
       "美国    洛杉矶            3     3570  1190.000000  2002  2010\n",
       "中国    杭州            19    13290   699.473684  2000  2015\n",
       "新加坡   新加坡            2     1350   675.000000  2012  2012\n",
       "美国    Emerville      1      500   500.000000  2007  2007\n",
       "瑞士    巴塞尔            1      500   500.000000  2014  2014\n",
       "美国    Harrisburg     1      500   500.000000  2016  2016\n",
       "      匹兹堡            1      500   500.000000  2015  2015\n",
       "印度    诺伊达            2      900   450.000000  2010  2010\n",
       "美国    门洛帕克           3     1300   433.333333  2013  2016\n",
       "      Plantation     1      400   400.000000  2011  2011\n",
       "中国    贵阳             1      400   400.000000  2014  2014\n",
       "印度尼西亚 雅加达            4     1570   392.500000  2009  2012\n",
       "中国    天津             3     1100   366.666667  2013  2018\n",
       "美国    普利茅斯           1      350   350.000000  2009  2009\n",
       "英国    曼彻斯特           1      350   350.000000  2004  2004\n",
       "韩国    城南市            1      350   350.000000  2007  2007\n",
       "美国    纽约            25     8640   345.600000  2002  2015\n",
       "      旧金山           55    17060   310.181818  2004  2017\n",
       "      加迪纳            1      300   300.000000  2014  2014\n",
       "      达拉斯            1      300   300.000000  2010  2010\n",
       "      帕洛阿尔托         10     2740   274.000000  2004  2016\n",
       "中国    北京            81    22130   273.209877  2001  2019\n",
       "      深圳            17     4440   261.176471  2006  2018\n",
       "美国    圣地亚哥           4     1010   252.500000  2008  2016\n",
       "瑞典    斯德哥尔摩          2      450   225.000000  2005  2016\n",
       "美国    坎布里奇           2      450   225.000000  2013  2014\n",
       "      圣马特奥           3      650   216.666667  2004  2017\n",
       "韩国    首尔             5     1010   202.000000  2005  2011\n",
       "美国    Foster City    1      200   200.000000  2014  2014\n",
       "澳大利亚  悉尼             1      200   200.000000  2012  2012\n",
       "...                ...      ...          ...   ...   ...\n",
       "美国    阿拉米达           1       70    70.000000  2011  2011\n",
       "中国    无锡             1       70    70.000000  2010  2010\n",
       "美国    罗利             1       70    70.000000  2011  2011\n",
       "菲律宾   马卡迪            1       70    70.000000  2015  2015\n",
       "芬兰    赫尔辛基           1       70    70.000000  2016  2016\n",
       "以色列   耐斯兹敖那          1       70    70.000000  2010  2010\n",
       "中国    金华             1       70    70.000000  2017  2017\n",
       "美国    盐湖城            1       70    70.000000  2008  2008\n",
       "      Guilford       1       70    70.000000  2011  2011\n",
       "爱沙尼亚  塔林             1       70    70.000000  2013  2013\n",
       "美国    Stafford       1       70    70.000000  2006  2006\n",
       "      克利尔沃特          1       70    70.000000  2010  2010\n",
       "德国    汉堡             1       70    70.000000  2014  2014\n",
       "美国    哥伦布            1       70    70.000000  2015  2015\n",
       "      圣克拉拉           2      140    70.000000  2005  2012\n",
       "      圣卡洛斯           1       70    70.000000  2001  2001\n",
       "哥伦比亚  波哥大            1       70    70.000000  2016  2016\n",
       "印度    新德里            1       70    70.000000  2012  2012\n",
       "美国    坎贝尔            1       70    70.000000  2007  2007\n",
       "      埃尔塞贡多          1       70    70.000000  2010  2010\n",
       "      夏洛特市           2      140    70.000000  2000  2011\n",
       "印度    孟买             1       70    70.000000  2012  2012\n",
       "美国    尔湾             1       70    70.000000  2013  2013\n",
       "卢森堡   卢森堡            1       70    70.000000  2014  2014\n",
       "美国    底特律            1       70    70.000000  2015  2015\n",
       "以色列   耶路撒冷           2      140    70.000000  2010  2013\n",
       "瑞士    洛桑市            1       70    70.000000  2012  2012\n",
       "美国    普莱森顿           1       70    70.000000  2012  2012\n",
       "      杭廷顿海滩          1       70    70.000000  2006  2006\n",
       "      半月湾            1       70    70.000000  2014  2014\n",
       "\n",
       "[121 rows x 5 columns]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 先行后城和先国后城\n",
    "先行后城 = df.groupby(by = [\"行业\",\"城市\"]) \\\n",
    "             .agg({\"企业名称\":\"count\",\"估值（亿人民币）\":[\"sum\",\"mean\"],\"成立年份\":[\"min\",\"max\"]}) \\\n",
    "             .sort_values(by = [(\"估值（亿人民币）\",\"mean\")],ascending = False) \\\n",
    "             .rename(columns = {\"sum\":\"总和\",\"mean\":\"均值\",\"count\":\"数量\",\"min\":\"最早\",\"max\":\"最新\"})\n",
    "先国后城 = df.groupby(by = [\"国家\",\"城市\"]) \\\n",
    "             .agg({\"企业名称\":\"count\",\"估值（亿人民币）\":[\"sum\",\"mean\"],\"成立年份\":[\"min\",\"max\"]}) \\\n",
    "             .sort_values(by = [(\"估值（亿人民币）\",\"mean\")],ascending = False) \\\n",
    "             .rename(columns = {\"sum\":\"总和\",\"mean\":\"均值\",\"count\":\"数量\",\"min\":\"最早\",\"max\":\"最新\"})\n",
    "display(先行后城)\n",
    "display(先国后城)\n",
    "\n",
    "with pd.ExcelWriter(\"练习excel分页.xlsx\") as writer:\n",
    "    先行后城.to_excel(writer,sheet_name=\"先行后城\")\n",
    "    先国后城.to_excel(writer,sheet_name=\"先国后城\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th colspan=\"2\" halign=\"left\">成立年份</th>\n",
       "      <th>企业名称</th>\n",
       "      <th colspan=\"2\" halign=\"left\">估值（亿人民币）</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>最早</th>\n",
       "      <th>最新</th>\n",
       "      <th>数量</th>\n",
       "      <th>总和</th>\n",
       "      <th>均值</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th>城市</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>洛杉矶</th>\n",
       "      <td>2002</td>\n",
       "      <td>2010</td>\n",
       "      <td>3</td>\n",
       "      <td>3570</td>\n",
       "      <td>1190.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>杭州</th>\n",
       "      <td>2000</td>\n",
       "      <td>2015</td>\n",
       "      <td>19</td>\n",
       "      <td>13290</td>\n",
       "      <td>699.473684</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新加坡</th>\n",
       "      <th>新加坡</th>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "      <td>2</td>\n",
       "      <td>1350</td>\n",
       "      <td>675.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>Emerville</th>\n",
       "      <td>2007</td>\n",
       "      <td>2007</td>\n",
       "      <td>1</td>\n",
       "      <td>500</td>\n",
       "      <td>500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞士</th>\n",
       "      <th>巴塞尔</th>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "      <td>1</td>\n",
       "      <td>500</td>\n",
       "      <td>500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">美国</th>\n",
       "      <th>Harrisburg</th>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "      <td>1</td>\n",
       "      <td>500</td>\n",
       "      <td>500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>匹兹堡</th>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "      <td>1</td>\n",
       "      <td>500</td>\n",
       "      <td>500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>诺伊达</th>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "      <td>2</td>\n",
       "      <td>900</td>\n",
       "      <td>450.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">美国</th>\n",
       "      <th>门洛帕克</th>\n",
       "      <td>2013</td>\n",
       "      <td>2016</td>\n",
       "      <td>3</td>\n",
       "      <td>1300</td>\n",
       "      <td>433.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Plantation</th>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "      <td>1</td>\n",
       "      <td>400</td>\n",
       "      <td>400.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>贵阳</th>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "      <td>1</td>\n",
       "      <td>400</td>\n",
       "      <td>400.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度尼西亚</th>\n",
       "      <th>雅加达</th>\n",
       "      <td>2009</td>\n",
       "      <td>2012</td>\n",
       "      <td>4</td>\n",
       "      <td>1570</td>\n",
       "      <td>392.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>天津</th>\n",
       "      <td>2013</td>\n",
       "      <td>2018</td>\n",
       "      <td>3</td>\n",
       "      <td>1100</td>\n",
       "      <td>366.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>普利茅斯</th>\n",
       "      <td>2009</td>\n",
       "      <td>2009</td>\n",
       "      <td>1</td>\n",
       "      <td>350</td>\n",
       "      <td>350.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>英国</th>\n",
       "      <th>曼彻斯特</th>\n",
       "      <td>2004</td>\n",
       "      <td>2004</td>\n",
       "      <td>1</td>\n",
       "      <td>350</td>\n",
       "      <td>350.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>韩国</th>\n",
       "      <th>城南市</th>\n",
       "      <td>2007</td>\n",
       "      <td>2007</td>\n",
       "      <td>1</td>\n",
       "      <td>350</td>\n",
       "      <td>350.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">美国</th>\n",
       "      <th>纽约</th>\n",
       "      <td>2002</td>\n",
       "      <td>2015</td>\n",
       "      <td>25</td>\n",
       "      <td>8640</td>\n",
       "      <td>345.600000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>旧金山</th>\n",
       "      <td>2004</td>\n",
       "      <td>2017</td>\n",
       "      <td>55</td>\n",
       "      <td>17060</td>\n",
       "      <td>310.181818</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>加迪纳</th>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "      <td>1</td>\n",
       "      <td>300</td>\n",
       "      <td>300.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>达拉斯</th>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "      <td>1</td>\n",
       "      <td>300</td>\n",
       "      <td>300.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>帕洛阿尔托</th>\n",
       "      <td>2004</td>\n",
       "      <td>2016</td>\n",
       "      <td>10</td>\n",
       "      <td>2740</td>\n",
       "      <td>274.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">中国</th>\n",
       "      <th>北京</th>\n",
       "      <td>2001</td>\n",
       "      <td>2019</td>\n",
       "      <td>81</td>\n",
       "      <td>22130</td>\n",
       "      <td>273.209877</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>深圳</th>\n",
       "      <td>2006</td>\n",
       "      <td>2018</td>\n",
       "      <td>17</td>\n",
       "      <td>4440</td>\n",
       "      <td>261.176471</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>圣地亚哥</th>\n",
       "      <td>2008</td>\n",
       "      <td>2016</td>\n",
       "      <td>4</td>\n",
       "      <td>1010</td>\n",
       "      <td>252.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞典</th>\n",
       "      <th>斯德哥尔摩</th>\n",
       "      <td>2005</td>\n",
       "      <td>2016</td>\n",
       "      <td>2</td>\n",
       "      <td>450</td>\n",
       "      <td>225.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">美国</th>\n",
       "      <th>坎布里奇</th>\n",
       "      <td>2013</td>\n",
       "      <td>2014</td>\n",
       "      <td>2</td>\n",
       "      <td>450</td>\n",
       "      <td>225.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣马特奥</th>\n",
       "      <td>2004</td>\n",
       "      <td>2017</td>\n",
       "      <td>3</td>\n",
       "      <td>650</td>\n",
       "      <td>216.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>韩国</th>\n",
       "      <th>首尔</th>\n",
       "      <td>2005</td>\n",
       "      <td>2011</td>\n",
       "      <td>5</td>\n",
       "      <td>1010</td>\n",
       "      <td>202.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>Foster City</th>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "      <td>1</td>\n",
       "      <td>200</td>\n",
       "      <td>200.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>澳大利亚</th>\n",
       "      <th>悉尼</th>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "      <td>1</td>\n",
       "      <td>200</td>\n",
       "      <td>200.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>阿拉米达</th>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>无锡</th>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>罗利</th>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>菲律宾</th>\n",
       "      <th>马卡迪</th>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芬兰</th>\n",
       "      <th>赫尔辛基</th>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <th>耐斯兹敖那</th>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>金华</th>\n",
       "      <td>2017</td>\n",
       "      <td>2017</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">美国</th>\n",
       "      <th>盐湖城</th>\n",
       "      <td>2008</td>\n",
       "      <td>2008</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Guilford</th>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>爱沙尼亚</th>\n",
       "      <th>塔林</th>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">美国</th>\n",
       "      <th>Stafford</th>\n",
       "      <td>2006</td>\n",
       "      <td>2006</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>克利尔沃特</th>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>德国</th>\n",
       "      <th>汉堡</th>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">美国</th>\n",
       "      <th>哥伦布</th>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣克拉拉</th>\n",
       "      <td>2005</td>\n",
       "      <td>2012</td>\n",
       "      <td>2</td>\n",
       "      <td>140</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣卡洛斯</th>\n",
       "      <td>2001</td>\n",
       "      <td>2001</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>哥伦比亚</th>\n",
       "      <th>波哥大</th>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>新德里</th>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">美国</th>\n",
       "      <th>坎贝尔</th>\n",
       "      <td>2007</td>\n",
       "      <td>2007</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>埃尔塞贡多</th>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>夏洛特市</th>\n",
       "      <td>2000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2</td>\n",
       "      <td>140</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>孟买</th>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>尔湾</th>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <th>卢森堡</th>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>底特律</th>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <th>耶路撒冷</th>\n",
       "      <td>2010</td>\n",
       "      <td>2013</td>\n",
       "      <td>2</td>\n",
       "      <td>140</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞士</th>\n",
       "      <th>洛桑市</th>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">美国</th>\n",
       "      <th>普莱森顿</th>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>杭廷顿海滩</th>\n",
       "      <td>2006</td>\n",
       "      <td>2006</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>半月湾</th>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>121 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                   成立年份       企业名称 估值（亿人民币）             \n",
       "                     最早    最新   数量       总和           均值\n",
       "国家    城市                                                \n",
       "美国    洛杉矶          2002  2010    3     3570  1190.000000\n",
       "中国    杭州           2000  2015   19    13290   699.473684\n",
       "新加坡   新加坡          2012  2012    2     1350   675.000000\n",
       "美国    Emerville    2007  2007    1      500   500.000000\n",
       "瑞士    巴塞尔          2014  2014    1      500   500.000000\n",
       "美国    Harrisburg   2016  2016    1      500   500.000000\n",
       "      匹兹堡          2015  2015    1      500   500.000000\n",
       "印度    诺伊达          2010  2010    2      900   450.000000\n",
       "美国    门洛帕克         2013  2016    3     1300   433.333333\n",
       "      Plantation   2011  2011    1      400   400.000000\n",
       "中国    贵阳           2014  2014    1      400   400.000000\n",
       "印度尼西亚 雅加达          2009  2012    4     1570   392.500000\n",
       "中国    天津           2013  2018    3     1100   366.666667\n",
       "美国    普利茅斯         2009  2009    1      350   350.000000\n",
       "英国    曼彻斯特         2004  2004    1      350   350.000000\n",
       "韩国    城南市          2007  2007    1      350   350.000000\n",
       "美国    纽约           2002  2015   25     8640   345.600000\n",
       "      旧金山          2004  2017   55    17060   310.181818\n",
       "      加迪纳          2014  2014    1      300   300.000000\n",
       "      达拉斯          2010  2010    1      300   300.000000\n",
       "      帕洛阿尔托        2004  2016   10     2740   274.000000\n",
       "中国    北京           2001  2019   81    22130   273.209877\n",
       "      深圳           2006  2018   17     4440   261.176471\n",
       "美国    圣地亚哥         2008  2016    4     1010   252.500000\n",
       "瑞典    斯德哥尔摩        2005  2016    2      450   225.000000\n",
       "美国    坎布里奇         2013  2014    2      450   225.000000\n",
       "      圣马特奥         2004  2017    3      650   216.666667\n",
       "韩国    首尔           2005  2011    5     1010   202.000000\n",
       "美国    Foster City  2014  2014    1      200   200.000000\n",
       "澳大利亚  悉尼           2012  2012    1      200   200.000000\n",
       "...                 ...   ...  ...      ...          ...\n",
       "美国    阿拉米达         2011  2011    1       70    70.000000\n",
       "中国    无锡           2010  2010    1       70    70.000000\n",
       "美国    罗利           2011  2011    1       70    70.000000\n",
       "菲律宾   马卡迪          2015  2015    1       70    70.000000\n",
       "芬兰    赫尔辛基         2016  2016    1       70    70.000000\n",
       "以色列   耐斯兹敖那        2010  2010    1       70    70.000000\n",
       "中国    金华           2017  2017    1       70    70.000000\n",
       "美国    盐湖城          2008  2008    1       70    70.000000\n",
       "      Guilford     2011  2011    1       70    70.000000\n",
       "爱沙尼亚  塔林           2013  2013    1       70    70.000000\n",
       "美国    Stafford     2006  2006    1       70    70.000000\n",
       "      克利尔沃特        2010  2010    1       70    70.000000\n",
       "德国    汉堡           2014  2014    1       70    70.000000\n",
       "美国    哥伦布          2015  2015    1       70    70.000000\n",
       "      圣克拉拉         2005  2012    2      140    70.000000\n",
       "      圣卡洛斯         2001  2001    1       70    70.000000\n",
       "哥伦比亚  波哥大          2016  2016    1       70    70.000000\n",
       "印度    新德里          2012  2012    1       70    70.000000\n",
       "美国    坎贝尔          2007  2007    1       70    70.000000\n",
       "      埃尔塞贡多        2010  2010    1       70    70.000000\n",
       "      夏洛特市         2000  2011    2      140    70.000000\n",
       "印度    孟买           2012  2012    1       70    70.000000\n",
       "美国    尔湾           2013  2013    1       70    70.000000\n",
       "卢森堡   卢森堡          2014  2014    1       70    70.000000\n",
       "美国    底特律          2015  2015    1       70    70.000000\n",
       "以色列   耶路撒冷         2010  2013    2      140    70.000000\n",
       "瑞士    洛桑市          2012  2012    1       70    70.000000\n",
       "美国    普莱森顿         2012  2012    1       70    70.000000\n",
       "      杭廷顿海滩        2006  2006    1       70    70.000000\n",
       "      半月湾          2014  2014    1       70    70.000000\n",
       "\n",
       "[121 rows x 5 columns]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "先国后城_2 = df.groupby(by = [\"国家\",\"城市\"]) \\\n",
    "             .agg({\"成立年份\":[\"min\",\"max\"],\"企业名称\":\"count\",\"估值（亿人民币）\":[\"sum\",\"mean\"]}) \\\n",
    "             .sort_values(by = [(\"估值（亿人民币）\",\"mean\")],ascending = False) \\\n",
    "             .rename(columns = {\"sum\":\"总和\",\"mean\":\"均值\",\"count\":\"数量\",\"min\":\"最早\",\"max\":\"最新\"})\n",
    "display(先国后城_2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 5. 数据感"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### （1）pandas类别数据：categorical"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0         中国\n",
      "1         中国\n",
      "2         中国\n",
      "3         美国\n",
      "4         美国\n",
      "5         美国\n",
      "6         中国\n",
      "7         美国\n",
      "8         美国\n",
      "9         美国\n",
      "10        中国\n",
      "11        中国\n",
      "12        中国\n",
      "13        中国\n",
      "14        中国\n",
      "15       新加坡\n",
      "16        美国\n",
      "17        美国\n",
      "18        美国\n",
      "19        中国\n",
      "20        中国\n",
      "21        美国\n",
      "22     印度尼西亚\n",
      "23        印度\n",
      "24        中国\n",
      "25        中国\n",
      "26        韩国\n",
      "27        中国\n",
      "28        美国\n",
      "29        美国\n",
      "       ...  \n",
      "464       中国\n",
      "465       印度\n",
      "466       美国\n",
      "467       中国\n",
      "468       中国\n",
      "469       美国\n",
      "470       美国\n",
      "471       美国\n",
      "472       美国\n",
      "473       中国\n",
      "474       美国\n",
      "475       中国\n",
      "476       中国\n",
      "477       中国\n",
      "478       中国\n",
      "479       韩国\n",
      "480       中国\n",
      "481       中国\n",
      "482       中国\n",
      "483       中国\n",
      "484       中国\n",
      "485       中国\n",
      "486       中国\n",
      "487       中国\n",
      "488       中国\n",
      "489       美国\n",
      "490       中国\n",
      "491       中国\n",
      "492       美国\n",
      "493       美国\n",
      "Name: 国家, Length: 494, dtype: category\n",
      "Categories (24, object): [中国, 以色列, 卢森堡, 印度, ..., 西班牙, 阿根廷, 韩国, 马耳他]\n"
     ]
    }
   ],
   "source": [
    "# pandas类别数据：categorical，使变量类型不再是object\n",
    "print(df.国家.astype('category'))\n",
    "# astype（）可用于转化dataframe某一列的数据类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "中国         AxesSubplot(0.1,0.15;0.363636x0.75)\n",
       "美国    AxesSubplot(0.536364,0.15;0.363636x0.75)\n",
       "dtype: object"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAEFCAYAAAAIZiutAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAaVUlEQVR4nO3df3Rc9Xnn8fdjWZZkmRJSx0pNG2RqN5UifpgoDS4K1cRJUzWFAIckjCm7Wyk45gSl2xOyJogscZo54BJITtwGR3RMKMVKDS1iXXAPa9BQ3IV27S5NfCwWumu7WTe0cUxMZGPJlp/9Y67kka6ER6MZje7V53WOjud+7517n5Gf0XO/93t/mLsjIiKSa165AxARk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fscynfdeK8ILHsFaKW7jz89TiR2lO9zg4qDiIiEaMxBRERCVBxERCRExUFEREJUHEREJOT/A56R9MIENpj6AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib as mpl  \n",
    "mpl.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签  \n",
    "mpl.rcParams['axes.unicode_minus']=False #用来正常显示负号 \n",
    "\n",
    "df[df.国家.isin([\"中国\",\"美国\"])][['国家',\"估值（亿人民币）\"]].groupby ( by = '国家' ).boxplot()\n",
    "# isin()可用来清洗数据，用来过滤dataframe的某些行\n",
    "# boxplot 箱型图/盒图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "中国         AxesSubplot(0.1,0.15;0.363636x0.75)\n",
       "美国    AxesSubplot(0.536364,0.15;0.363636x0.75)\n",
       "dtype: object"
      ]
     },
     "execution_count": 79,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAEGCAYAAACZ0MnKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAbcUlEQVR4nO3df5BV5Z3n8feHXw2BhIEJ6UQ3SpFiE/AHFeiMUktqLirNSJzZrE5F8UeldjAIjuzsUlMF2EyMUYg4NdRYJDSBoYxmla04s2aJiDZK3wokmgmYVRnRqc0uZDRSYwKDwR+t4nf/uAe5XO/tfvpym9u3+/OqukWf5z7nOc85PPDp81sRgZmZWYoh9e6AmZk1DoeGmZklc2iYmVkyh4aZmSVzaJiZWTKHxgAj6V5J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b13zSpb3ReCvKfx29y3gFUlHKLyS99PAP1E4Rvzd2q6m2Qc85vsxh0b/Nwq4EmjO/nwWuBkYAXy9qN4aCrvsV2TTf0LhGDAAkoZmP5Y9HilpCIXDlQ9KmgWMBy4B3qHwG9k8SSsovDt4R21Wzawsj/l+zCfC+79zgN8CYykc1z0ATANWF1eKiCeBc7MrPkRh8D9eVGUhheO7bwE/zHbXP5udFHwk+25BSZtvAp+ncFgACseT36zp2pl9mMd8P+Y9jX5M0seAj1G4quNu4Dbg74BdwB8Dn8jqbIiI94E7gDFAK5DPdsdP/DbVDrSXtP+ziLiCDxsCDJE0gsIx3b/MyicAR2u7lmYnecz3fw6N/m0xcD/wE+Am4DvA30TEA5IeAO4BvgrslvR+6cySdlO4muR7wKYy7Y+psNwmCocC/gZ4MCL2Z1e0jAP++XRWyKwHHvP9nC+57cdOXG8eEe9mu9+fjIhXi77/9xHRZwNaksIDxM4gj/n+z6FhZmbJfCLczMySOTTMzCyZQ8PMzJI5NMzMLJlDw8zMkv1/GXM7FIzYu9kAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "df[df.国家.isin([\"中国\",\"美国\"])][[\"国家\",\"成立年份\"]].groupby(by=\"国家\").boxplot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>企业名称</th>\n",
       "      <th colspan=\"2\" halign=\"left\">估值（亿人民币）</th>\n",
       "      <th colspan=\"2\" halign=\"left\">成立年份</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>数量</th>\n",
       "      <th>总和</th>\n",
       "      <th>均值</th>\n",
       "      <th>最新</th>\n",
       "      <th>最早</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>城市</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>北京</th>\n",
       "      <td>81</td>\n",
       "      <td>22130</td>\n",
       "      <td>273.209877</td>\n",
       "      <td>2019</td>\n",
       "      <td>2001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>旧金山</th>\n",
       "      <td>55</td>\n",
       "      <td>17060</td>\n",
       "      <td>310.181818</td>\n",
       "      <td>2017</td>\n",
       "      <td>2004</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>杭州</th>\n",
       "      <td>19</td>\n",
       "      <td>13290</td>\n",
       "      <td>699.473684</td>\n",
       "      <td>2015</td>\n",
       "      <td>2000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>上海</th>\n",
       "      <td>47</td>\n",
       "      <td>8990</td>\n",
       "      <td>191.276596</td>\n",
       "      <td>2017</td>\n",
       "      <td>2001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>纽约</th>\n",
       "      <td>25</td>\n",
       "      <td>8640</td>\n",
       "      <td>345.600000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2002</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>深圳</th>\n",
       "      <td>17</td>\n",
       "      <td>4440</td>\n",
       "      <td>261.176471</td>\n",
       "      <td>2018</td>\n",
       "      <td>2006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>洛杉矶</th>\n",
       "      <td>3</td>\n",
       "      <td>3570</td>\n",
       "      <td>1190.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2002</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>帕洛阿尔托</th>\n",
       "      <td>10</td>\n",
       "      <td>2740</td>\n",
       "      <td>274.000000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2004</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>伦敦</th>\n",
       "      <td>9</td>\n",
       "      <td>1700</td>\n",
       "      <td>188.888889</td>\n",
       "      <td>2015</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>雅加达</th>\n",
       "      <td>4</td>\n",
       "      <td>1570</td>\n",
       "      <td>392.500000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>南京</th>\n",
       "      <td>11</td>\n",
       "      <td>1550</td>\n",
       "      <td>140.909091</td>\n",
       "      <td>2018</td>\n",
       "      <td>2006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>班加罗尔</th>\n",
       "      <td>9</td>\n",
       "      <td>1500</td>\n",
       "      <td>166.666667</td>\n",
       "      <td>2017</td>\n",
       "      <td>2004</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新加坡</th>\n",
       "      <td>2</td>\n",
       "      <td>1350</td>\n",
       "      <td>675.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>门洛帕克</th>\n",
       "      <td>3</td>\n",
       "      <td>1300</td>\n",
       "      <td>433.333333</td>\n",
       "      <td>2016</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>古尔冈</th>\n",
       "      <td>7</td>\n",
       "      <td>1160</td>\n",
       "      <td>165.714286</td>\n",
       "      <td>2014</td>\n",
       "      <td>2008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>天津</th>\n",
       "      <td>3</td>\n",
       "      <td>1100</td>\n",
       "      <td>366.666667</td>\n",
       "      <td>2018</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣地亚哥</th>\n",
       "      <td>4</td>\n",
       "      <td>1010</td>\n",
       "      <td>252.500000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>首尔</th>\n",
       "      <td>5</td>\n",
       "      <td>1010</td>\n",
       "      <td>202.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2005</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>广州</th>\n",
       "      <td>8</td>\n",
       "      <td>1000</td>\n",
       "      <td>125.000000</td>\n",
       "      <td>2017</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>诺伊达</th>\n",
       "      <td>2</td>\n",
       "      <td>900</td>\n",
       "      <td>450.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>雷德伍德城</th>\n",
       "      <td>9</td>\n",
       "      <td>870</td>\n",
       "      <td>96.666667</td>\n",
       "      <td>2014</td>\n",
       "      <td>2000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>波士顿</th>\n",
       "      <td>8</td>\n",
       "      <td>820</td>\n",
       "      <td>102.500000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>山景城</th>\n",
       "      <td>6</td>\n",
       "      <td>660</td>\n",
       "      <td>110.000000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣马特奥</th>\n",
       "      <td>3</td>\n",
       "      <td>650</td>\n",
       "      <td>216.666667</td>\n",
       "      <td>2017</td>\n",
       "      <td>2004</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>柏林</th>\n",
       "      <td>4</td>\n",
       "      <td>640</td>\n",
       "      <td>160.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芝加哥</th>\n",
       "      <td>4</td>\n",
       "      <td>570</td>\n",
       "      <td>142.500000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣保罗</th>\n",
       "      <td>4</td>\n",
       "      <td>510</td>\n",
       "      <td>127.500000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>匹兹堡</th>\n",
       "      <td>1</td>\n",
       "      <td>500</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>巴塞尔</th>\n",
       "      <td>1</td>\n",
       "      <td>500</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Emerville</th>\n",
       "      <td>1</td>\n",
       "      <td>500</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>2007</td>\n",
       "      <td>2007</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>贝尔维尤</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>赫尔辛基</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>阿拉米达</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>迈阿密</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Stafford</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2006</td>\n",
       "      <td>2006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>苗必达</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2007</td>\n",
       "      <td>2007</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>耐斯兹敖那</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>孟买</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>尔湾</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>塔林</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>布宜诺斯艾利斯</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>埃尔塞贡多</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>底特律</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>坎贝尔</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2007</td>\n",
       "      <td>2007</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新德里</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>无锡</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010</td>\n",
       "      <td>2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>圣卡洛斯</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2001</td>\n",
       "      <td>2001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>普莱森顿</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>杭廷顿海滩</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2006</td>\n",
       "      <td>2006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>桐乡</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>哥伦布</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2015</td>\n",
       "      <td>2015</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>汉堡</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>波哥大</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2016</td>\n",
       "      <td>2016</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>台北</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2006</td>\n",
       "      <td>2006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>洛桑市</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>盐湖城</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2008</td>\n",
       "      <td>2008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>半月湾</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>罗利</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>马德里</th>\n",
       "      <td>1</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011</td>\n",
       "      <td>2011</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>120 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          企业名称 估值（亿人民币）               成立年份      \n",
       "            数量       总和           均值    最新    最早\n",
       "城市                                              \n",
       "北京          81    22130   273.209877  2019  2001\n",
       "旧金山         55    17060   310.181818  2017  2004\n",
       "杭州          19    13290   699.473684  2015  2000\n",
       "上海          47     8990   191.276596  2017  2001\n",
       "纽约          25     8640   345.600000  2015  2002\n",
       "深圳          17     4440   261.176471  2018  2006\n",
       "洛杉矶          3     3570  1190.000000  2010  2002\n",
       "帕洛阿尔托       10     2740   274.000000  2016  2004\n",
       "伦敦           9     1700   188.888889  2015  2011\n",
       "雅加达          4     1570   392.500000  2012  2009\n",
       "南京          11     1550   140.909091  2018  2006\n",
       "班加罗尔         9     1500   166.666667  2017  2004\n",
       "新加坡          2     1350   675.000000  2012  2012\n",
       "门洛帕克         3     1300   433.333333  2016  2013\n",
       "古尔冈          7     1160   165.714286  2014  2008\n",
       "天津           3     1100   366.666667  2018  2013\n",
       "圣地亚哥         4     1010   252.500000  2016  2008\n",
       "首尔           5     1010   202.000000  2011  2005\n",
       "广州           8     1000   125.000000  2017  2011\n",
       "诺伊达          2      900   450.000000  2010  2010\n",
       "雷德伍德城        9      870    96.666667  2014  2000\n",
       "波士顿          8      820   102.500000  2013  2001\n",
       "山景城          6      660   110.000000  2015  2006\n",
       "圣马特奥         3      650   216.666667  2017  2004\n",
       "柏林           4      640   160.000000  2013  2009\n",
       "芝加哥          4      570   142.500000  2015  2012\n",
       "圣保罗          4      510   127.500000  2013  2011\n",
       "匹兹堡          1      500   500.000000  2015  2015\n",
       "巴塞尔          1      500   500.000000  2014  2014\n",
       "Emerville    1      500   500.000000  2007  2007\n",
       "...        ...      ...          ...   ...   ...\n",
       "贝尔维尤         1       70    70.000000  2011  2011\n",
       "赫尔辛基         1       70    70.000000  2016  2016\n",
       "阿拉米达         1       70    70.000000  2011  2011\n",
       "迈阿密          1       70    70.000000  2013  2013\n",
       "Stafford     1       70    70.000000  2006  2006\n",
       "卢森堡          1       70    70.000000  2014  2014\n",
       "苗必达          1       70    70.000000  2007  2007\n",
       "耐斯兹敖那        1       70    70.000000  2010  2010\n",
       "孟买           1       70    70.000000  2012  2012\n",
       "尔湾           1       70    70.000000  2013  2013\n",
       "塔林           1       70    70.000000  2013  2013\n",
       "布宜诺斯艾利斯      1       70    70.000000  2013  2013\n",
       "埃尔塞贡多        1       70    70.000000  2010  2010\n",
       "底特律          1       70    70.000000  2015  2015\n",
       "坎贝尔          1       70    70.000000  2007  2007\n",
       "新德里          1       70    70.000000  2012  2012\n",
       "无锡           1       70    70.000000  2010  2010\n",
       "圣卡洛斯         1       70    70.000000  2001  2001\n",
       "普莱森顿         1       70    70.000000  2012  2012\n",
       "杭廷顿海滩        1       70    70.000000  2006  2006\n",
       "桐乡           1       70    70.000000  2014  2014\n",
       "哥伦布          1       70    70.000000  2015  2015\n",
       "汉堡           1       70    70.000000  2014  2014\n",
       "波哥大          1       70    70.000000  2016  2016\n",
       "台北           1       70    70.000000  2006  2006\n",
       "洛桑市          1       70    70.000000  2012  2012\n",
       "盐湖城          1       70    70.000000  2008  2008\n",
       "半月湾          1       70    70.000000  2014  2014\n",
       "罗利           1       70    70.000000  2011  2011\n",
       "马德里          1       70    70.000000  2011  2011\n",
       "\n",
       "[120 rows x 5 columns]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "city = df.groupby(by=[\"城市\"]) \\\n",
    "         .agg({\"企业名称\" : \"count\", \\\n",
    "              \"估值（亿人民币）\":[\"sum\",\"mean\"], \\\n",
    "              \"成立年份\":[\"max\",\"min\"],}) \\\n",
    "             .sort_values ( by = [(\"估值（亿人民币）\",\"sum\")], ascending = False) \\\n",
    "             .rename ( columns = {\"sum\":\"总和\", \"mean\":\"均值\", \"count\":\"数量\", \"max\":\"最新\", \"min\":\"最早\"} )\n",
    "display(city)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['北京', '旧金山', '杭州', '上海', '纽约'], dtype='object', name='城市')"
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "city.index[0:5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "上海          AxesSubplot(0.1,0.679412;0.363636x0.220588)\n",
       "北京     AxesSubplot(0.536364,0.679412;0.363636x0.220588)\n",
       "旧金山         AxesSubplot(0.1,0.414706;0.363636x0.220588)\n",
       "杭州     AxesSubplot(0.536364,0.414706;0.363636x0.220588)\n",
       "纽约              AxesSubplot(0.1,0.15;0.363636x0.220588)\n",
       "dtype: object"
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEGCAYAAABo25JHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3de5xU9X3/8debZQEDSiDiqkkUNWrWamnN2oquKauBRGNbazQBMdW4SmpSamJtBNd4qW4Uqz5MTeRiNkof0fXnJW0M4O2R7EaJwUdBYjTZ2KYtary0QS66RBCWz++PcxYG3GVnlllmZs/7+XjsY+d8z/ec+Z7Z785nvrczigjMzCy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OMcCAYJScMlHVbqcphZ5XEgKBOSvinpWEkLJb2/h/0/SGdh9eYckkV/fT3PDZLqJA2R9GeSDpN04e6U3cwqmwNB+RiR/r4bOE+Jam3/WrL7gWO6M0uqznk8DrgeGCVpkaQV6e8lktpy8o0gWeS3EphIct+ol4HPDuB1mVmZ82BxiUi6GzgM2JAmHUZyT6Z1wHCSu7zOAmpJFuftcDjwWkR8IQ0Ii4EfR8SN6bmXRcR7FvBJugQYFxFXSvoeMCcinpd0O9AaEU8X+zrNrPz5O4tLZytwUUT8GkDSl0luy/ECMCFdgPcVSQ0RkfupfihwdUR8PU36IMltPPaXtChNO1LSEpK/78MR8S1JHwYuA1okNQBbI+L5NP81wPclnR4Rbw/kRZtZ+XEgKJ0A7km7fp4FFgGHAn8C/CYn32xJmyNiabp9HPDRbSeJWAVcJenHwJSI2JK2CE7b6flOAv6JpOVxA/CqpLXAc8CHgV+SjDPML+5lmlm5cyAonb2AM4Ga9PdzwJeAYcBVOfnmkHQRnZ5u/wXJOAIAkqrShz328UkaQtIFeK+kemAscDLwLklr4TRJs4HlEfFEcS7NzCqJB4tL5yDgTWA0ydjAKpK7tH4jN1NE/Ag4OJ3dI5I38cdysswgGSN4B/i3tHvoyHSweFG6r3Gnc/6e5IuDXkiThgO/L+rVmVnFcIugBCTtA+xDMoPnJuBq4DvAU8CfA/uleeZFxFbgOpLvdJgCtKfdP92f9OcCc3c6/zMRcTrvNQQYkt5a/BqSMQNIvnlufXGv0swqhQNBaVwM/AvwU+CLwLeBWyLiHkn3AN8EzgOWStq688GSlpLMHLobuLOH84/q5XmHk3Q93QLcGxEd6eylMcB/7M4FmVnl8vTREuheAxARm9Punv0j4vWc/UdExIC9MUtS+A9vZikHAjOzjPNgsZlZxjkQmJllnAOBmVnGORCYmWWcA4GZWcb9f9LmYJKzIx2IAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 6 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "df[df.城市.isin(city.index[0:5])][[\"城市\",\"成立年份\"]].groupby(by=\"城市\").boxplot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 494 entries, 0 to 493\n",
      "Data columns (total 10 columns):\n",
      "排名              494 non-null int64\n",
      "企业名称            494 non-null object\n",
      "Company Name    494 non-null object\n",
      "估值（亿人民币）        494 non-null int64\n",
      "国家              494 non-null category\n",
      "城市              494 non-null category\n",
      "行业              494 non-null category\n",
      "掌门人/创始人         494 non-null object\n",
      "成立年份            494 non-null int64\n",
      "部分投资机构          494 non-null object\n",
      "dtypes: category(3), int64(3), object(4)\n",
      "memory usage: 36.1+ KB\n"
     ]
    }
   ],
   "source": [
    "new_df = df.copy()\n",
    "new_df = new_df.assign(国家=df.国家.astype('category'))\n",
    "new_df = new_df.assign(城市=df.城市.astype('category'))\n",
    "new_df = new_df.assign(行业=df.行业.astype('category'))\n",
    "new_df.info()\n",
    "# assign 直接向dataframe对象添加新的一列\n",
    "# 此时，国家、城市、行业的对象类型已经从object变成category"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 494 entries, 0 to 493\n",
      "Data columns (total 10 columns):\n",
      "排名              494 non-null int64\n",
      "企业名称            494 non-null object\n",
      "Company Name    494 non-null object\n",
      "估值（亿人民币）        494 non-null int64\n",
      "国家              494 non-null object\n",
      "城市              494 non-null object\n",
      "行业              494 non-null object\n",
      "掌门人/创始人         494 non-null object\n",
      "成立年份            494 non-null int64\n",
      "部分投资机构          494 non-null object\n",
      "dtypes: int64(3), object(7)\n",
      "memory usage: 38.7+ KB\n"
     ]
    }
   ],
   "source": [
    "df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>估值（亿人民币）</th>\n",
       "      <th>成立年份</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <td>39407</td>\n",
       "      <td>54700</td>\n",
       "      <td>414473</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <td>1470</td>\n",
       "      <td>730</td>\n",
       "      <td>14068</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <td>264</td>\n",
       "      <td>70</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <td>3576</td>\n",
       "      <td>3850</td>\n",
       "      <td>42215</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度尼西亚</th>\n",
       "      <td>378</td>\n",
       "      <td>1570</td>\n",
       "      <td>8042</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          排名  估值（亿人民币）    成立年份\n",
       "国家                            \n",
       "中国     39407     54700  414473\n",
       "以色列     1470       730   14068\n",
       "卢森堡      264        70    2014\n",
       "印度      3576      3850   42215\n",
       "印度尼西亚    378      1570    8042"
      ]
     },
     "execution_count": 85,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.groupby(\"国家\").sum().head()\n",
    "# .sum()只筛选数据类型是int的列\n",
    "# 此时国家是索引列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>国家</th>\n",
       "      <th>排名</th>\n",
       "      <th>估值（亿人民币）</th>\n",
       "      <th>成立年份</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>中国</td>\n",
       "      <td>39407</td>\n",
       "      <td>54700</td>\n",
       "      <td>414473</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>以色列</td>\n",
       "      <td>1470</td>\n",
       "      <td>730</td>\n",
       "      <td>14068</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>卢森堡</td>\n",
       "      <td>264</td>\n",
       "      <td>70</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>印度</td>\n",
       "      <td>3576</td>\n",
       "      <td>3850</td>\n",
       "      <td>42215</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>印度尼西亚</td>\n",
       "      <td>378</td>\n",
       "      <td>1570</td>\n",
       "      <td>8042</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      国家     排名  估值（亿人民币）    成立年份\n",
       "0     中国  39407     54700  414473\n",
       "1    以色列   1470       730   14068\n",
       "2    卢森堡    264        70    2014\n",
       "3     印度   3576      3850   42215\n",
       "4  印度尼西亚    378      1570    8042"
      ]
     },
     "execution_count": 86,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.groupby(\"国家\",as_index=False).sum().head()\n",
    "# 此时国家不是索引列\n",
    "# as_index=True时，没有显示索引项，而是以第一列为索引，这时不能用df.loc[]进行取值\n",
    "# as_index=False时，显示索引项，可以用df.loc[]进行取值\n",
    "# as_index的作用时控制聚合输出是否以组标签为索引值"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### (2)groupby 查询所有数据列的统计"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>排名</th>\n",
       "      <th>估值（亿人民币）</th>\n",
       "      <th>成立年份</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th>行业</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"21\" valign=\"top\">中国</th>\n",
       "      <th>云计算</th>\n",
       "      <td>230.800000</td>\n",
       "      <td>92.000000</td>\n",
       "      <td>2012.400000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <td>189.333333</td>\n",
       "      <td>139.333333</td>\n",
       "      <td>2013.466667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>健康科技</th>\n",
       "      <td>206.538462</td>\n",
       "      <td>158.461538</td>\n",
       "      <td>2011.384615</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <td>148.750000</td>\n",
       "      <td>592.500000</td>\n",
       "      <td>2014.375000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>区块链</th>\n",
       "      <td>116.500000</td>\n",
       "      <td>312.500000</td>\n",
       "      <td>2014.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>大数据</th>\n",
       "      <td>250.666667</td>\n",
       "      <td>80.000000</td>\n",
       "      <td>2011.111111</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>媒体和娱乐</th>\n",
       "      <td>151.647059</td>\n",
       "      <td>484.117647</td>\n",
       "      <td>2011.529412</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>房地产科技</th>\n",
       "      <td>183.142857</td>\n",
       "      <td>191.428571</td>\n",
       "      <td>2012.571429</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>教育科技</th>\n",
       "      <td>211.272727</td>\n",
       "      <td>108.181818</td>\n",
       "      <td>2010.181818</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新能源</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2007.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新能源汽车</th>\n",
       "      <td>168.500000</td>\n",
       "      <td>150.833333</td>\n",
       "      <td>2015.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新零售</th>\n",
       "      <td>232.500000</td>\n",
       "      <td>90.000000</td>\n",
       "      <td>2013.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>机器人</th>\n",
       "      <td>98.666667</td>\n",
       "      <td>466.666667</td>\n",
       "      <td>2010.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>消费品</th>\n",
       "      <td>170.750000</td>\n",
       "      <td>155.000000</td>\n",
       "      <td>2014.750000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>游戏</th>\n",
       "      <td>224.000000</td>\n",
       "      <td>100.000000</td>\n",
       "      <td>2015.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <td>182.125000</td>\n",
       "      <td>244.375000</td>\n",
       "      <td>2011.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <td>209.000000</td>\n",
       "      <td>110.000000</td>\n",
       "      <td>2010.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>209.424242</td>\n",
       "      <td>127.878788</td>\n",
       "      <td>2011.303030</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>网络安全</th>\n",
       "      <td>84.000000</td>\n",
       "      <td>200.000000</td>\n",
       "      <td>2015.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>软件与服务</th>\n",
       "      <td>224.533333</td>\n",
       "      <td>97.333333</td>\n",
       "      <td>2010.400000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <td>174.363636</td>\n",
       "      <td>816.363636</td>\n",
       "      <td>2012.136364</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">以色列</th>\n",
       "      <th>云计算</th>\n",
       "      <td>201.000000</td>\n",
       "      <td>110.000000</td>\n",
       "      <td>2011.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2010.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>软件与服务</th>\n",
       "      <td>138.000000</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2002.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <th>电子商务</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2014.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">印度</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>119.000000</td>\n",
       "      <td>273.333333</td>\n",
       "      <td>2013.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>即时通讯</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2012.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>大数据</th>\n",
       "      <td>138.000000</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2004.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>教育科技</th>\n",
       "      <td>43.000000</td>\n",
       "      <td>400.000000</td>\n",
       "      <td>2008.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"14\" valign=\"top\">美国</th>\n",
       "      <th>新能源</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2007.800000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新能源汽车</th>\n",
       "      <td>123.666667</td>\n",
       "      <td>240.000000</td>\n",
       "      <td>2012.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新零售</th>\n",
       "      <td>243.000000</td>\n",
       "      <td>83.333333</td>\n",
       "      <td>2010.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>机器人</th>\n",
       "      <td>84.000000</td>\n",
       "      <td>200.000000</td>\n",
       "      <td>2016.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>消费品</th>\n",
       "      <td>173.000000</td>\n",
       "      <td>580.000000</td>\n",
       "      <td>2012.714286</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>游戏</th>\n",
       "      <td>124.000000</td>\n",
       "      <td>194.000000</td>\n",
       "      <td>2008.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <td>148.777778</td>\n",
       "      <td>256.666667</td>\n",
       "      <td>2012.888889</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <td>131.600000</td>\n",
       "      <td>266.000000</td>\n",
       "      <td>2011.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>201.235294</td>\n",
       "      <td>155.294118</td>\n",
       "      <td>2011.411765</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>网络安全</th>\n",
       "      <td>225.666667</td>\n",
       "      <td>141.666667</td>\n",
       "      <td>2010.833333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>航天</th>\n",
       "      <td>118.666667</td>\n",
       "      <td>923.333333</td>\n",
       "      <td>2006.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>虚拟与增强现实</th>\n",
       "      <td>50.000000</td>\n",
       "      <td>350.000000</td>\n",
       "      <td>2010.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>软件与服务</th>\n",
       "      <td>232.500000</td>\n",
       "      <td>90.000000</td>\n",
       "      <td>2010.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <td>144.761905</td>\n",
       "      <td>239.047619</td>\n",
       "      <td>2010.952381</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芬兰</th>\n",
       "      <th>消费品</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2016.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"7\" valign=\"top\">英国</th>\n",
       "      <th>人工智能</th>\n",
       "      <td>138.000000</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2014.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新能源</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2009.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>游戏</th>\n",
       "      <td>138.000000</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2012.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <td>138.000000</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2012.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <td>138.000000</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2005.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>50.000000</td>\n",
       "      <td>350.000000</td>\n",
       "      <td>2004.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <td>97.333333</td>\n",
       "      <td>208.333333</td>\n",
       "      <td>2012.833333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>菲律宾</th>\n",
       "      <th>房地产科技</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2015.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西班牙</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>阿根廷</th>\n",
       "      <th>云计算</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2013.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">韩国</th>\n",
       "      <th>游戏</th>\n",
       "      <td>50.000000</td>\n",
       "      <td>350.000000</td>\n",
       "      <td>2007.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <td>84.000000</td>\n",
       "      <td>200.000000</td>\n",
       "      <td>2011.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>184.333333</td>\n",
       "      <td>246.666667</td>\n",
       "      <td>2008.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <td>264.000000</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>2011.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>马耳他</th>\n",
       "      <th>区块链</th>\n",
       "      <td>138.000000</td>\n",
       "      <td>150.000000</td>\n",
       "      <td>2017.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>103 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                     排名    估值（亿人民币）         成立年份\n",
       "国家  行业                                          \n",
       "中国  云计算      230.800000   92.000000  2012.400000\n",
       "    人工智能     189.333333  139.333333  2013.466667\n",
       "    健康科技     206.538462  158.461538  2011.384615\n",
       "    共享经济     148.750000  592.500000  2014.375000\n",
       "    区块链      116.500000  312.500000  2014.000000\n",
       "    大数据      250.666667   80.000000  2011.111111\n",
       "    媒体和娱乐    151.647059  484.117647  2011.529412\n",
       "    房地产科技    183.142857  191.428571  2012.571429\n",
       "    教育科技     211.272727  108.181818  2010.181818\n",
       "    新能源      264.000000   70.000000  2007.000000\n",
       "    新能源汽车    168.500000  150.833333  2015.666667\n",
       "    新零售      232.500000   90.000000  2013.500000\n",
       "    机器人       98.666667  466.666667  2010.333333\n",
       "    消费品      170.750000  155.000000  2014.750000\n",
       "    游戏       224.000000  100.000000  2015.000000\n",
       "    物流       182.125000  244.375000  2011.250000\n",
       "    生命科学     209.000000  110.000000  2010.500000\n",
       "    电子商务     209.424242  127.878788  2011.303030\n",
       "    网络安全      84.000000  200.000000  2015.000000\n",
       "    软件与服务    224.533333   97.333333  2010.400000\n",
       "    金融科技     174.363636  816.363636  2012.136364\n",
       "以色列 云计算      201.000000  110.000000  2011.500000\n",
       "    人工智能     264.000000   70.000000  2010.000000\n",
       "    生命科学     264.000000   70.000000  2010.000000\n",
       "    软件与服务    138.000000  150.000000  2002.000000\n",
       "卢森堡 电子商务     264.000000   70.000000  2014.000000\n",
       "印度  共享经济     119.000000  273.333333  2013.333333\n",
       "    即时通讯     264.000000   70.000000  2012.000000\n",
       "    大数据      138.000000  150.000000  2004.000000\n",
       "    教育科技      43.000000  400.000000  2008.000000\n",
       "...                 ...         ...          ...\n",
       "美国  新能源      264.000000   70.000000  2007.800000\n",
       "    新能源汽车    123.666667  240.000000  2012.666667\n",
       "    新零售      243.000000   83.333333  2010.500000\n",
       "    机器人       84.000000  200.000000  2016.000000\n",
       "    消费品      173.000000  580.000000  2012.714286\n",
       "    游戏       124.000000  194.000000  2008.000000\n",
       "    物流       148.777778  256.666667  2012.888889\n",
       "    生命科学     131.600000  266.000000  2011.500000\n",
       "    电子商务     201.235294  155.294118  2011.411765\n",
       "    网络安全     225.666667  141.666667  2010.833333\n",
       "    航天       118.666667  923.333333  2006.666667\n",
       "    虚拟与增强现实   50.000000  350.000000  2010.500000\n",
       "    软件与服务    232.500000   90.000000  2010.500000\n",
       "    金融科技     144.761905  239.047619  2010.952381\n",
       "芬兰  消费品      264.000000   70.000000  2016.000000\n",
       "英国  人工智能     138.000000  150.000000  2014.500000\n",
       "    新能源      264.000000   70.000000  2009.000000\n",
       "    游戏       138.000000  150.000000  2012.000000\n",
       "    物流       138.000000  150.000000  2012.000000\n",
       "    生命科学     138.000000  150.000000  2005.000000\n",
       "    电子商务      50.000000  350.000000  2004.000000\n",
       "    金融科技      97.333333  208.333333  2012.833333\n",
       "菲律宾 房地产科技    264.000000   70.000000  2015.000000\n",
       "西班牙 共享经济     264.000000   70.000000  2011.000000\n",
       "阿根廷 云计算      264.000000   70.000000  2013.000000\n",
       "韩国  游戏        50.000000  350.000000  2007.000000\n",
       "    物流        84.000000  200.000000  2011.000000\n",
       "    电子商务     184.333333  246.666667  2008.333333\n",
       "    金融科技     264.000000   70.000000  2011.000000\n",
       "马耳他 区块链      138.000000  150.000000  2017.000000\n",
       "\n",
       "[103 rows x 3 columns]"
      ]
     },
     "execution_count": 87,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.groupby(['国家','行业']).mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th colspan=\"4\" halign=\"left\">排名</th>\n",
       "      <th colspan=\"4\" halign=\"left\">估值（亿人民币）</th>\n",
       "      <th colspan=\"4\" halign=\"left\">成立年份</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>sum</th>\n",
       "      <th>mean</th>\n",
       "      <th>min</th>\n",
       "      <th>max</th>\n",
       "      <th>sum</th>\n",
       "      <th>mean</th>\n",
       "      <th>min</th>\n",
       "      <th>max</th>\n",
       "      <th>sum</th>\n",
       "      <th>mean</th>\n",
       "      <th>min</th>\n",
       "      <th>max</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <td>39407</td>\n",
       "      <td>191.296117</td>\n",
       "      <td>1</td>\n",
       "      <td>264</td>\n",
       "      <td>54700</td>\n",
       "      <td>265.533981</td>\n",
       "      <td>70</td>\n",
       "      <td>10000</td>\n",
       "      <td>414473</td>\n",
       "      <td>2012.004854</td>\n",
       "      <td>2000</td>\n",
       "      <td>2019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <td>1470</td>\n",
       "      <td>210.000000</td>\n",
       "      <td>138</td>\n",
       "      <td>264</td>\n",
       "      <td>730</td>\n",
       "      <td>104.285714</td>\n",
       "      <td>70</td>\n",
       "      <td>150</td>\n",
       "      <td>14068</td>\n",
       "      <td>2009.714286</td>\n",
       "      <td>2002</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <td>264</td>\n",
       "      <td>264.000000</td>\n",
       "      <td>264</td>\n",
       "      <td>264</td>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "      <td>70</td>\n",
       "      <td>70</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014.000000</td>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <td>3576</td>\n",
       "      <td>170.285714</td>\n",
       "      <td>23</td>\n",
       "      <td>264</td>\n",
       "      <td>3850</td>\n",
       "      <td>183.333333</td>\n",
       "      <td>70</td>\n",
       "      <td>700</td>\n",
       "      <td>42215</td>\n",
       "      <td>2010.238095</td>\n",
       "      <td>2000</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度尼西亚</th>\n",
       "      <td>378</td>\n",
       "      <td>94.500000</td>\n",
       "      <td>23</td>\n",
       "      <td>264</td>\n",
       "      <td>1570</td>\n",
       "      <td>392.500000</td>\n",
       "      <td>70</td>\n",
       "      <td>700</td>\n",
       "      <td>8042</td>\n",
       "      <td>2010.500000</td>\n",
       "      <td>2009</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          排名                       估值（亿人民币）                           成立年份  \\\n",
       "         sum        mean  min  max      sum        mean min    max     sum   \n",
       "国家                                                                           \n",
       "中国     39407  191.296117    1  264    54700  265.533981  70  10000  414473   \n",
       "以色列     1470  210.000000  138  264      730  104.285714  70    150   14068   \n",
       "卢森堡      264  264.000000  264  264       70   70.000000  70     70    2014   \n",
       "印度      3576  170.285714   23  264     3850  183.333333  70    700   42215   \n",
       "印度尼西亚    378   94.500000   23  264     1570  392.500000  70    700    8042   \n",
       "\n",
       "                                \n",
       "              mean   min   max  \n",
       "国家                              \n",
       "中国     2012.004854  2000  2019  \n",
       "以色列    2009.714286  2002  2013  \n",
       "卢森堡    2014.000000  2014  2014  \n",
       "印度     2010.238095  2000  2017  \n",
       "印度尼西亚  2010.500000  2009  2012  "
      ]
     },
     "execution_count": 88,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 同时查看多种数据\n",
    "df.groupby(\"国家\").agg([\"sum\",\"mean\",\"min\",\"max\"]).head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th colspan=\"2\" halign=\"left\">估值（亿人民币）</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>sum</th>\n",
       "      <th>mean</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <td>54700</td>\n",
       "      <td>265.533981</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <td>730</td>\n",
       "      <td>104.285714</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <td>70</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <td>3850</td>\n",
       "      <td>183.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度尼西亚</th>\n",
       "      <td>1570</td>\n",
       "      <td>392.500000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      估值（亿人民币）            \n",
       "           sum        mean\n",
       "国家                        \n",
       "中国       54700  265.533981\n",
       "以色列        730  104.285714\n",
       "卢森堡         70   70.000000\n",
       "印度        3850  183.333333\n",
       "印度尼西亚     1570  392.500000"
      ]
     },
     "execution_count": 89,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 筛选查看我们想要的数据\n",
    "df.groupby(\"国家\")[[\"估值（亿人民币）\"]].agg([\"sum\",\"mean\"]).head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th colspan=\"2\" halign=\"left\">成立年份</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>min</th>\n",
       "      <th>max</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <td>2000</td>\n",
       "      <td>2019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <td>2002</td>\n",
       "      <td>2013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <td>2014</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <td>2000</td>\n",
       "      <td>2017</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度尼西亚</th>\n",
       "      <td>2009</td>\n",
       "      <td>2012</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       成立年份      \n",
       "        min   max\n",
       "国家               \n",
       "中国     2000  2019\n",
       "以色列    2002  2013\n",
       "卢森堡    2014  2014\n",
       "印度     2000  2017\n",
       "印度尼西亚  2009  2012"
      ]
     },
     "execution_count": 90,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.groupby(\"国家\")[[\"成立年份\"]].agg([\"min\",\"max\"]).head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### (3)groupby排序"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>sum</th>\n",
       "      <th>count</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th>行业</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">中国</th>\n",
       "      <th>金融科技</th>\n",
       "      <td>17960</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>媒体和娱乐</th>\n",
       "      <td>8230</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <td>4740</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">美国</th>\n",
       "      <th>云计算</th>\n",
       "      <td>6880</td>\n",
       "      <td>32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>消费品</th>\n",
       "      <td>4060</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <td>5670</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>航天</th>\n",
       "      <td>2770</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <td>5020</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">中国</th>\n",
       "      <th>物流</th>\n",
       "      <td>3910</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>机器人</th>\n",
       "      <td>1400</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新加坡</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>1000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">美国</th>\n",
       "      <th>媒体和娱乐</th>\n",
       "      <td>1720</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>大数据</th>\n",
       "      <td>1850</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <td>2310</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>区块链</th>\n",
       "      <td>1250</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>生命科学</th>\n",
       "      <td>2660</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度尼西亚</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>700</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>金融科技</th>\n",
       "      <td>920</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">中国</th>\n",
       "      <th>房地产科技</th>\n",
       "      <td>1340</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>4220</td>\n",
       "      <td>33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>韩国</th>\n",
       "      <th>电子商务</th>\n",
       "      <td>740</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>健康科技</th>\n",
       "      <td>2060</td>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">美国</th>\n",
       "      <th>电子商务</th>\n",
       "      <td>2640</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>区块链</th>\n",
       "      <td>1170</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>人工智能</th>\n",
       "      <td>3080</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞士</th>\n",
       "      <th>生命科学</th>\n",
       "      <td>500</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>网络安全</th>\n",
       "      <td>850</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度尼西亚</th>\n",
       "      <th>电子商务</th>\n",
       "      <td>870</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>教育科技</th>\n",
       "      <td>400</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>虚拟与增强现实</th>\n",
       "      <td>700</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日本</th>\n",
       "      <th>人工智能</th>\n",
       "      <td>150</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>软件与服务</th>\n",
       "      <td>360</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>新能源</th>\n",
       "      <td>150</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">中国</th>\n",
       "      <th>游戏</th>\n",
       "      <td>100</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>大数据</th>\n",
       "      <td>720</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>教育科技</th>\n",
       "      <td>210</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>阿根廷</th>\n",
       "      <th>云计算</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>新零售</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>爱沙尼亚</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西班牙</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>新能源</th>\n",
       "      <td>350</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">法国</th>\n",
       "      <th>媒体和娱乐</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>健康科技</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>游戏</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>新能源</th>\n",
       "      <td>140</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <th>电子商务</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>巴西</th>\n",
       "      <th>健康科技</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>即时通讯</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芬兰</th>\n",
       "      <th>消费品</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>巴西</th>\n",
       "      <th>物流</th>\n",
       "      <td>140</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>软件与服务</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <th>生命科学</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日本</th>\n",
       "      <th>区块链</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>法国</th>\n",
       "      <th>人工智能</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞士</th>\n",
       "      <th>虚拟与增强现实</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <th>人工智能</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>英国</th>\n",
       "      <th>新能源</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>哥伦比亚</th>\n",
       "      <th>物流</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>菲律宾</th>\n",
       "      <th>房地产科技</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>韩国</th>\n",
       "      <th>金融科技</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>103 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                 sum  count\n",
       "国家    行业                   \n",
       "中国    金融科技     17960     22\n",
       "      媒体和娱乐     8230     17\n",
       "      共享经济      4740      8\n",
       "美国    云计算       6880     32\n",
       "      消费品       4060      7\n",
       "      共享经济      5670      6\n",
       "      航天        2770      3\n",
       "      金融科技      5020     21\n",
       "中国    物流        3910     16\n",
       "      机器人       1400      3\n",
       "新加坡   共享经济      1000      1\n",
       "美国    媒体和娱乐     1720      6\n",
       "      大数据       1850      8\n",
       "      物流        2310      9\n",
       "中国    区块链       1250      4\n",
       "美国    生命科学      2660     10\n",
       "印度尼西亚 共享经济       700      1\n",
       "印度    金融科技       920      3\n",
       "中国    房地产科技     1340      7\n",
       "      电子商务      4220     33\n",
       "韩国    电子商务       740      3\n",
       "中国    健康科技      2060     13\n",
       "美国    电子商务      2640     17\n",
       "      区块链       1170      4\n",
       "      人工智能      3080     20\n",
       "瑞士    生命科学       500      1\n",
       "美国    网络安全       850      6\n",
       "印度尼西亚 电子商务       870      3\n",
       "印度    教育科技       400      1\n",
       "美国    虚拟与增强现实    700      2\n",
       "...              ...    ...\n",
       "日本    人工智能       150      1\n",
       "美国    软件与服务      360      4\n",
       "印度    新能源        150      1\n",
       "中国    游戏         100      1\n",
       "      大数据        720      9\n",
       "美国    教育科技       210      3\n",
       "阿根廷   云计算         70      1\n",
       "印度    新零售         70      1\n",
       "爱沙尼亚  共享经济        70      1\n",
       "西班牙   共享经济        70      1\n",
       "美国    新能源        350      5\n",
       "法国    媒体和娱乐       70      1\n",
       "      健康科技        70      1\n",
       "印度    游戏          70      1\n",
       "中国    新能源        140      2\n",
       "卢森堡   电子商务        70      1\n",
       "巴西    健康科技        70      1\n",
       "印度    即时通讯        70      1\n",
       "芬兰    消费品         70      1\n",
       "巴西    物流         140      2\n",
       "印度    软件与服务       70      1\n",
       "以色列   生命科学        70      1\n",
       "日本    区块链         70      1\n",
       "法国    人工智能        70      1\n",
       "瑞士    虚拟与增强现实     70      1\n",
       "以色列   人工智能        70      1\n",
       "英国    新能源         70      1\n",
       "哥伦比亚  物流          70      1\n",
       "菲律宾   房地产科技       70      1\n",
       "韩国    金融科技        70      1\n",
       "\n",
       "[103 rows x 2 columns]"
      ]
     },
     "execution_count": 91,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# sort\n",
    "# sort=True(排序)/False\n",
    "df.groupby([\"国家\",\"行业\"],sort=False).agg([\"sum\",\"count\"])[\"估值（亿人民币）\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>sum</th>\n",
       "      <th>count</th>\n",
       "      <th>mean</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>国家</th>\n",
       "      <th>行业</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">中国</th>\n",
       "      <th>金融科技</th>\n",
       "      <td>17960</td>\n",
       "      <td>22</td>\n",
       "      <td>816.363636</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>媒体和娱乐</th>\n",
       "      <td>8230</td>\n",
       "      <td>17</td>\n",
       "      <td>484.117647</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">美国</th>\n",
       "      <th>云计算</th>\n",
       "      <td>6880</td>\n",
       "      <td>32</td>\n",
       "      <td>215.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>共享经济</th>\n",
       "      <td>5670</td>\n",
       "      <td>6</td>\n",
       "      <td>945.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>金融科技</th>\n",
       "      <td>5020</td>\n",
       "      <td>21</td>\n",
       "      <td>239.047619</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">中国</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>4740</td>\n",
       "      <td>8</td>\n",
       "      <td>592.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>4220</td>\n",
       "      <td>33</td>\n",
       "      <td>127.878788</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>消费品</th>\n",
       "      <td>4060</td>\n",
       "      <td>7</td>\n",
       "      <td>580.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>物流</th>\n",
       "      <td>3910</td>\n",
       "      <td>16</td>\n",
       "      <td>244.375000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">美国</th>\n",
       "      <th>人工智能</th>\n",
       "      <td>3080</td>\n",
       "      <td>20</td>\n",
       "      <td>154.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>航天</th>\n",
       "      <td>2770</td>\n",
       "      <td>3</td>\n",
       "      <td>923.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>生命科学</th>\n",
       "      <td>2660</td>\n",
       "      <td>10</td>\n",
       "      <td>266.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>电子商务</th>\n",
       "      <td>2640</td>\n",
       "      <td>17</td>\n",
       "      <td>155.294118</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>物流</th>\n",
       "      <td>2310</td>\n",
       "      <td>9</td>\n",
       "      <td>256.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">中国</th>\n",
       "      <th>人工智能</th>\n",
       "      <td>2090</td>\n",
       "      <td>15</td>\n",
       "      <td>139.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>健康科技</th>\n",
       "      <td>2060</td>\n",
       "      <td>13</td>\n",
       "      <td>158.461538</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>大数据</th>\n",
       "      <td>1850</td>\n",
       "      <td>8</td>\n",
       "      <td>231.250000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>新能源汽车</th>\n",
       "      <td>1810</td>\n",
       "      <td>12</td>\n",
       "      <td>150.833333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">美国</th>\n",
       "      <th>媒体和娱乐</th>\n",
       "      <td>1720</td>\n",
       "      <td>6</td>\n",
       "      <td>286.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>健康科技</th>\n",
       "      <td>1550</td>\n",
       "      <td>12</td>\n",
       "      <td>129.166667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">中国</th>\n",
       "      <th>软件与服务</th>\n",
       "      <td>1460</td>\n",
       "      <td>15</td>\n",
       "      <td>97.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>机器人</th>\n",
       "      <td>1400</td>\n",
       "      <td>3</td>\n",
       "      <td>466.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>房地产科技</th>\n",
       "      <td>1340</td>\n",
       "      <td>7</td>\n",
       "      <td>191.428571</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>英国</th>\n",
       "      <th>金融科技</th>\n",
       "      <td>1250</td>\n",
       "      <td>6</td>\n",
       "      <td>208.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">中国</th>\n",
       "      <th>区块链</th>\n",
       "      <td>1250</td>\n",
       "      <td>4</td>\n",
       "      <td>312.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>教育科技</th>\n",
       "      <td>1190</td>\n",
       "      <td>11</td>\n",
       "      <td>108.181818</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>区块链</th>\n",
       "      <td>1170</td>\n",
       "      <td>4</td>\n",
       "      <td>292.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>新加坡</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>1000</td>\n",
       "      <td>1</td>\n",
       "      <td>1000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>美国</th>\n",
       "      <th>游戏</th>\n",
       "      <td>970</td>\n",
       "      <td>5</td>\n",
       "      <td>194.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>金融科技</th>\n",
       "      <td>920</td>\n",
       "      <td>3</td>\n",
       "      <td>306.666667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <th>软件与服务</th>\n",
       "      <td>150</td>\n",
       "      <td>1</td>\n",
       "      <td>150.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞士</th>\n",
       "      <th>区块链</th>\n",
       "      <td>150</td>\n",
       "      <td>1</td>\n",
       "      <td>150.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日本</th>\n",
       "      <th>人工智能</th>\n",
       "      <td>150</td>\n",
       "      <td>1</td>\n",
       "      <td>150.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>大数据</th>\n",
       "      <td>150</td>\n",
       "      <td>1</td>\n",
       "      <td>150.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>爱尔兰</th>\n",
       "      <th>云计算</th>\n",
       "      <td>150</td>\n",
       "      <td>1</td>\n",
       "      <td>150.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞典</th>\n",
       "      <th>新能源</th>\n",
       "      <td>150</td>\n",
       "      <td>1</td>\n",
       "      <td>150.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>新能源</th>\n",
       "      <td>140</td>\n",
       "      <td>2</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>巴西</th>\n",
       "      <th>物流</th>\n",
       "      <td>140</td>\n",
       "      <td>2</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>中国</th>\n",
       "      <th>游戏</th>\n",
       "      <td>100</td>\n",
       "      <td>1</td>\n",
       "      <td>100.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <th>人工智能</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>即时通讯</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>阿根廷</th>\n",
       "      <th>云计算</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西班牙</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>菲律宾</th>\n",
       "      <th>房地产科技</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>以色列</th>\n",
       "      <th>生命科学</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>韩国</th>\n",
       "      <th>金融科技</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>卢森堡</th>\n",
       "      <th>电子商务</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>瑞士</th>\n",
       "      <th>虚拟与增强现实</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>印度</th>\n",
       "      <th>新零售</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>英国</th>\n",
       "      <th>新能源</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芬兰</th>\n",
       "      <th>消费品</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">印度</th>\n",
       "      <th>游戏</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>软件与服务</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>哥伦比亚</th>\n",
       "      <th>物流</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>巴西</th>\n",
       "      <th>健康科技</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>日本</th>\n",
       "      <th>区块链</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">法国</th>\n",
       "      <th>人工智能</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>媒体和娱乐</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>爱沙尼亚</th>\n",
       "      <th>共享经济</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>法国</th>\n",
       "      <th>健康科技</th>\n",
       "      <td>70</td>\n",
       "      <td>1</td>\n",
       "      <td>70.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>103 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                sum  count         mean\n",
       "国家   行业                                \n",
       "中国   金融科技     17960     22   816.363636\n",
       "     媒体和娱乐     8230     17   484.117647\n",
       "美国   云计算       6880     32   215.000000\n",
       "     共享经济      5670      6   945.000000\n",
       "     金融科技      5020     21   239.047619\n",
       "中国   共享经济      4740      8   592.500000\n",
       "     电子商务      4220     33   127.878788\n",
       "美国   消费品       4060      7   580.000000\n",
       "中国   物流        3910     16   244.375000\n",
       "美国   人工智能      3080     20   154.000000\n",
       "     航天        2770      3   923.333333\n",
       "     生命科学      2660     10   266.000000\n",
       "     电子商务      2640     17   155.294118\n",
       "     物流        2310      9   256.666667\n",
       "中国   人工智能      2090     15   139.333333\n",
       "     健康科技      2060     13   158.461538\n",
       "美国   大数据       1850      8   231.250000\n",
       "中国   新能源汽车     1810     12   150.833333\n",
       "美国   媒体和娱乐     1720      6   286.666667\n",
       "     健康科技      1550     12   129.166667\n",
       "中国   软件与服务     1460     15    97.333333\n",
       "     机器人       1400      3   466.666667\n",
       "     房地产科技     1340      7   191.428571\n",
       "英国   金融科技      1250      6   208.333333\n",
       "中国   区块链       1250      4   312.500000\n",
       "     教育科技      1190     11   108.181818\n",
       "美国   区块链       1170      4   292.500000\n",
       "新加坡  共享经济      1000      1  1000.000000\n",
       "美国   游戏         970      5   194.000000\n",
       "印度   金融科技       920      3   306.666667\n",
       "...             ...    ...          ...\n",
       "以色列  软件与服务      150      1   150.000000\n",
       "瑞士   区块链        150      1   150.000000\n",
       "日本   人工智能       150      1   150.000000\n",
       "印度   大数据        150      1   150.000000\n",
       "爱尔兰  云计算        150      1   150.000000\n",
       "瑞典   新能源        150      1   150.000000\n",
       "中国   新能源        140      2    70.000000\n",
       "巴西   物流         140      2    70.000000\n",
       "中国   游戏         100      1   100.000000\n",
       "以色列  人工智能        70      1    70.000000\n",
       "印度   即时通讯        70      1    70.000000\n",
       "阿根廷  云计算         70      1    70.000000\n",
       "西班牙  共享经济        70      1    70.000000\n",
       "菲律宾  房地产科技       70      1    70.000000\n",
       "以色列  生命科学        70      1    70.000000\n",
       "韩国   金融科技        70      1    70.000000\n",
       "卢森堡  电子商务        70      1    70.000000\n",
       "瑞士   虚拟与增强现实     70      1    70.000000\n",
       "印度   新零售         70      1    70.000000\n",
       "英国   新能源         70      1    70.000000\n",
       "芬兰   消费品         70      1    70.000000\n",
       "印度   游戏          70      1    70.000000\n",
       "     软件与服务       70      1    70.000000\n",
       "哥伦比亚 物流          70      1    70.000000\n",
       "巴西   健康科技        70      1    70.000000\n",
       "日本   区块链         70      1    70.000000\n",
       "法国   人工智能        70      1    70.000000\n",
       "     媒体和娱乐       70      1    70.000000\n",
       "爱沙尼亚 共享经济        70      1    70.000000\n",
       "法国   健康科技        70      1    70.000000\n",
       "\n",
       "[103 rows x 3 columns]"
      ]
     },
     "execution_count": 92,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# sort_values()\n",
    "df.groupby([\"国家\",\"行业\"]).agg([\"sum\",\"count\",\"mean\"])[\"估值（亿人民币）\"].sort_values(by=\"sum\",ascending=False)\n",
    "# ascending=True 为升序排列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
